A method for generating a recipe recommendation list and related apparatus
By optimizing recipe recommendations using deep Q-value networks and Boltzmann distributions, the problem of low ingredient utilization in traditional recipe recommendations is solved, generating a list of recommended recipes that meet user needs and improving ingredient utilization and the rationality of recommendations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-23
- Publication Date
- 2026-03-03
AI Technical Summary
Traditional recipe recommendation methods fail to effectively utilize the ingredients stored in users' refrigerators, resulting in low ingredient utilization.
By constructing a feature matrix based on the feature vectors of ingredients stored by the user through a deep Q-value network, the recommended value of the recipe is determined, and the recipe recommendation is optimized by Boltzmann distribution to generate a list of recommended recipes to improve the utilization rate of ingredients.
It improves the utilization rate of food in the user's refrigerator, ensures that the recommended recipes can make full use of the stored ingredients, and generates a list of recommended recipes that best meet the user's needs based on the user's taste preferences.
Smart Images

Figure CN115687742B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing and intelligent recommendation technology, and in particular to a method and related apparatus for generating a recipe recommendation list. Background Technology
[0002] With the rapid development of internet technology, many internet-based marketing platforms offer various online services to facilitate users' daily lives. For example, food-related platforms can recommend various cooking recipes to users online. Users can view recipe recommendations through the marketing accounts or applications of various food-related platforms.
[0003] In related technologies, recipe recommendation systems typically recommend recipes based on their popularity, suggesting those with high success rates. However, individual tastes vary, and the refrigerator may not always contain the necessary ingredients for the recommended recipes. Therefore, traditional recipe recommendation methods have a low utilization rate of stored ingredients. Summary of the Invention
[0004] This application provides a method and related apparatus for generating a recipe recommendation list to improve the utilization rate of ingredients.
[0005] In a first aspect, embodiments of this application provide a method for generating a recipe recommendation list, the method comprising:
[0006] Retrieve food data already stored in the storage device;
[0007] Based on a deep Q-value network, a recommendation value for each recipe in a preset recipe set is determined according to the ingredient data; wherein, the deep Q-value network includes multiple recommendation sub-networks for determining the recommendation value of the recipe, and the recommendation value is determined based on the action value and advantage value of the recipe;
[0008] Target recipes are determined based on the recommendation values of each recipe, and a list of recommended recipes is generated based on the number of times the target recipes are recommended.
[0009] This application embodiment, after acquiring the food data stored in the storage device, determines the recommendation value of each recipe in a preset recipe set based on a deep Q-value network. This recommendation value represents the user's satisfaction with the recipe. The recommendation value is determined by the deep Q-value network based on the action value and advantage value of the recipe from the food data. This accelerates the convergence of the neural network and quickly determines the recommendation value of the recipe. Furthermore, this application determines target recipes and the number of times each target recipe is recommended based on its recommendation value. Target recipes represent recipes that can be cooked using the stored ingredients. A recipe recommendation list is generated based on the number of times the target recipes are recommended. Each target recipe in the recipe recommendation list obtained through the above process can be cooked using the stored ingredients, improving the utilization rate of the ingredients.
[0010] In some possible embodiments, determining the target recipe based on the recommendation values of each recipe includes:
[0011] A feature matrix is constructed based on the ingredient data and the feature vectors of pre-stored ingredients; wherein, the pre-stored ingredients include the already stored ingredients;
[0012] Based on the feature matrix, the recommendation value of each recipe in the preset recipe set is determined through each of the recommendation sub-networks;
[0013] The recipe corresponding to the maximum value among the recommended values determined by each of the aforementioned recommendation sub-networks is taken as the target recipe.
[0014] This application embodiment constructs a feature matrix representing the features of stored ingredients using ingredient data and feature vectors of preset ingredients. By inputting this feature matrix into each recommendation sub-network, the target recipe with the highest recommendation value is obtained. This ensures that the obtained target recipe can be cooked using the stored ingredients, and that the user's expectations for the target recipe are the highest.
[0015] In some possible embodiments, the recommendation subnetwork includes convolutional layers and fully connected layers, and the action value and advantage value of the target recipe are determined in the following manner:
[0016] For each of the recommendation subnetworks, the target vector corresponding to the feature matrix is determined by the convolutional layer based on the feature matrix;
[0017] Based on the target vector, the action value and advantage value corresponding to each recipe in the preset recipe set are determined through the fully connected layer; wherein, the preset recipe set includes the target recipe.
[0018] In this embodiment, the fully connected layer of the recommendation subnetwork can extract the action value and advantage value of the recipe based on the target vector output by the convolutional layer. This accelerates the convergence of the neural network model.
[0019] In some possible embodiments, the recommended values for each recipe are determined in the following ways:
[0020] For each recipe, the sum of the action value and the advantage value is used as the recommended value for that recipe.
[0021] In this embodiment, the recipe recommendation value represents the user's satisfaction with the recipe, the action value represents the user's average expectation for all recipes corresponding to the stored ingredients, and the dominance value represents the higher expectation that the recommended recipe is compared to other recipes. Therefore, the dominance value is the difference between the recommendation value and the action value. Thus, using the sum of the action value and the dominance value of each recipe as the recommendation value yields an accurate result.
[0022] In some possible embodiments, determining the target recipe based on the recommended value of the recipe includes:
[0023] Based on the recommendation values of each recipe, the recommendation probability of each recipe is determined using the Boltzmann distribution;
[0024] The target recipe is determined based on the recommendation probability.
[0025] In this embodiment, the Boltzmann distribution is used to determine the probability of each recipe being recommended, and the target recipe is selected based on the recommendation probability of each recipe. This reduces the situation where suboptimal and worst actions are selected with equal probability in the greedy algorithm, thereby improving the rationality of recipe recommendations.
[0026] In some possible embodiments, generating the recipe recommendation list based on the number of times the target recipe is recommended includes:
[0027] The number of times each target recipe is output by the recommendation subnetwork is counted, and the number of times each target recipe is output is taken as the recommendation number.
[0028] The recommended recipe list is generated based on the target recipes that meet the preset requirements in terms of the number of recommendations.
[0029] In this embodiment, the network parameters of each recommendation sub-network are different. Therefore, the target recipes obtained by inputting the same feature matrix into each recommendation sub-network will not be exactly the same. The number of times each target recipe is output is the number of times the recommendation sub-network considers it to have the highest recommendation value, i.e., the recommendation number. The recipe recommendation list obtained by filtering the target recipes output by each recommendation sub-network based on the recommendation number can ensure that each target recipe on the list has the highest user satisfaction as much as possible.
[0030] In some possible embodiments, generating the recipe recommendation list based on target recipes that meet a preset requirement in terms of the number of recommendations includes:
[0031] The target recipes whose recommendation frequency exceeds the recommendation threshold are designated as recipes to be recommended, and a recipe recommendation list is generated according to the recommendation frequency of each recipe to be recommended in descending order; or,
[0032] The target recipes are sorted in descending order of their recommendation frequency, and the top n target recipes are selected from the sorted list.
[0033] The recommended list of recipes is generated based on the first n target recipes; where n is a positive integer.
[0034] In this embodiment, by setting a recommendation threshold to filter the number of recommendations, outliers in the recommendation subnetwork output (i.e., target recipes with a low number of recommendations) can be removed, thereby improving user satisfaction with each target recipe in the recipe recommendation list. Furthermore, the number of recipes in the recipe recommendation list can be set, and recommending each target recipe from highest to lowest recommendation count can improve the recommendation value of a recipe by using the sum of its action value and advantage value.
[0035] Secondly, embodiments of this application provide a storage device, including: a display, a memory, and a controller, wherein:
[0036] The display is used to display information;
[0037] The memory is used to store computer programs that can be executed by the controller;
[0038] The controller, connected to both the display and the memory, is configured as follows:
[0039] Retrieve the stored ingredient data;
[0040] Based on a deep Q-value network, a recommendation value for each recipe in a preset recipe set is determined according to the ingredient data; wherein, the deep Q-value network includes multiple recommendation sub-networks for determining the recommendation value of the recipe, and the recommendation value is determined based on the action value and advantage value of the recipe;
[0041] Target recipes are determined based on the recommendation values of each recipe, and a list of recommended recipes is generated based on the number of times the target recipes are recommended.
[0042] In some possible embodiments, the controller is configured to perform the determination of the target recipe based on the recommended values of each recipe, wherein:
[0043] A feature matrix is constructed based on the ingredient data and the feature vectors of pre-stored ingredients; wherein, the pre-stored ingredients include the already stored ingredients;
[0044] Based on the feature matrix, the recommendation value of each recipe in the preset recipe set is determined through each of the recommendation sub-networks;
[0045] The recipe corresponding to the maximum value among the recommended values determined by each of the aforementioned recommendation sub-networks is taken as the target recipe.
[0046] In some possible embodiments, the recommendation subnetwork includes convolutional layers and fully connected layers, and the action value and advantage value of the target recipe are determined in the following manner:
[0047] For each of the recommendation subnetworks, the target vector corresponding to the feature matrix is determined by the convolutional layer based on the feature matrix;
[0048] Based on the target vector, the action value and advantage value corresponding to each recipe in the preset recipe set are determined through the fully connected layer; wherein, the preset recipe set includes the target recipe.
[0049] In some possible embodiments, the recommended values for each recipe are determined in the following ways:
[0050] For each recipe, the sum of the action value and the advantage value is used as the recommended value for that recipe.
[0051] In some possible embodiments, the controller is configured to perform the determination of the target recipe based on the recommended values of each recipe, wherein:
[0052] Based on the recommendation values of each recipe, the recommendation probability of each recipe is determined using the Boltzmann distribution;
[0053] The target recipe is determined based on the recommendation probability.
[0054] In some possible embodiments, the controller is configured to perform the generation of a recipe recommendation list based on the number of recommendations of the target recipe, wherein the controller is configured to:
[0055] The number of times each target recipe is output by the recommendation subnetwork is counted, and the number of times each target recipe is output is taken as the recommendation number.
[0056] The recommended recipe list is generated based on the target recipes that meet the preset requirements in terms of the number of recommendations.
[0057] In some possible embodiments, the controller is configured to generate the recipe recommendation list based on the target recipes that meet a preset requirement in terms of the number of recommendations.
[0058] The target recipes whose recommendation frequency exceeds the recommendation threshold are designated as recipes to be recommended, and a recipe recommendation list is generated according to the recommendation frequency of each recipe to be recommended in descending order; or,
[0059] The target recipes are sorted in descending order of their recommendation frequency, and the top n target recipes are selected from the sorted list.
[0060] The recommended list of recipes is generated based on the first n target recipes; where n is a positive integer.
[0061] Thirdly, embodiments of this application provide an apparatus for generating a recipe recommendation list, the apparatus comprising:
[0062] The ingredient data determination module is configured to retrieve the ingredient data already stored in the storage device;
[0063] The recommendation value acquisition module is configured to execute a deep Q-value network to determine the recommendation value of each recipe in the preset recipe set based on the ingredient data; wherein, the deep Q-value network includes multiple recommendation sub-networks for determining the recommendation value of the recipe, and the recommendation value is determined based on the action value and advantage value of the recipe;
[0064] The recommendation list generation module is configured to determine the target recipe based on the recommendation value of each recipe, and generate a recipe recommendation list based on the number of times the target recipe is recommended.
[0065] In some possible embodiments, the process of determining the target recipe based on the recommendation values of each recipe is performed, and the recommendation list generation module is configured to:
[0066] A feature matrix is constructed based on the ingredient data and the feature vectors of pre-stored ingredients; wherein, the pre-stored ingredients include the already stored ingredients;
[0067] Based on the feature matrix, the recommendation value of each recipe in the preset recipe set is determined through each of the recommendation sub-networks;
[0068] The recipe corresponding to the maximum value among the recommended values determined by each of the aforementioned recommendation sub-networks is taken as the target recipe.
[0069] In some possible embodiments, the recommendation subnetwork includes convolutional layers and fully connected layers, and the action value and advantage value of the target recipe are determined in the following manner:
[0070] For each of the recommendation subnetworks, the target vector corresponding to the feature matrix is determined by the convolutional layer based on the feature matrix;
[0071] Based on the target vector, the action value and advantage value corresponding to each recipe in the preset recipe set are determined through the fully connected layer; wherein, the preset recipe set includes the target recipe.
[0072] In some possible embodiments, the recommended values for each recipe are determined in the following ways:
[0073] For each recipe, the sum of the action value and the advantage value is used as the recommended value for that recipe.
[0074] In some possible embodiments, the process of determining the target recipe based on the recommendation values of each recipe is performed, and the recommendation list generation module is configured to:
[0075] Based on the recommendation values of each recipe, the recommendation probability of each recipe is determined using the Boltzmann distribution;
[0076] The target recipe is determined based on the recommendation probability.
[0077] In some possible embodiments, the process of generating a recipe recommendation list based on the number of recommendations of the target recipe is performed, and the recommendation list generation module is configured to:
[0078] The number of times each target recipe is output by the recommendation subnetwork is counted, and the number of times each target recipe is output is taken as the recommendation number.
[0079] The recommended recipe list is generated based on the target recipes that meet the preset requirements in terms of the number of recommendations.
[0080] In some possible embodiments, the process of generating the recipe recommendation list based on the target recipes that meet a preset requirement in terms of the number of recommendations is performed. The recommendation list generation module is configured to:
[0081] The target recipes whose recommendation frequency exceeds the recommendation threshold are designated as recipes to be recommended, and a recipe recommendation list is generated according to the recommendation frequency of each recipe to be recommended in descending order; or,
[0082] The target recipes are sorted in descending order of their recommendation frequency, and the top n target recipes are selected from the sorted list.
[0083] The recommended list of recipes is generated based on the first n target recipes; where n is a positive integer.
[0084] Fourthly, embodiments of this application also provide a computer storage medium storing computer program instructions, which, when executed on a computer, cause the computer to perform the method for generating a recipe recommendation list as described in the first aspect.
[0085] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0086] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0087] Figure 1 This is a schematic diagram illustrating an application scenario provided in the embodiments of this application;
[0088] Figure 2 This is a schematic diagram illustrating another application scenario provided by an embodiment of this application;
[0089] Figure 3a A flowchart illustrating the overall process for generating a recommended recipe list as provided in this application embodiment;
[0090] Figure 3b This is a schematic diagram illustrating the acquisition of food ingredient data provided in an embodiment of this application.
[0091] Figure 3c This is a schematic diagram of a set of preset recipes provided in an embodiment of this application;
[0092] Figure 3d A schematic diagram of the recommended sub-network structure provided in the embodiments of this application;
[0093] Figure 3e This is a schematic diagram of the output results of each recommendation subnetwork provided in the embodiments of this application;
[0094] Figure 3f This is a schematic diagram of the recommended recipe list provided in the embodiments of this application;
[0095] Figure 4 This is a schematic diagram of the structure of a storage device provided in an embodiment of this application;
[0096] Figure 5 A schematic diagram of a recipe recommendation list generation device provided in an embodiment of this application. Detailed Implementation
[0097] The technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or", for example, A / B can mean A or B; "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.
[0098] In the description of the embodiments of this application, unless otherwise stated, the term "multiple" refers to two or more, and other quantifiers are similarly understood. The preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.
[0099] To further illustrate the technical solutions provided in the embodiments of this application, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of this application provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on conventional or non-inventive effort. For steps that do not logically have a necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of this application. In actual processing or when the control device executes the method, it may be executed sequentially or in parallel according to the method shown in the embodiments or drawings.
[0100] In related technologies, food-related platforms or applications often recommend recipes based on their popularity and taste in a fixed pattern. For example, they might recommend five popular recipes daily, including two mild, two spicy, and one sweet recipe. However, this method doesn't consider the user's individual circumstances, such as whether the ingredients in the user's refrigerator are suitable for cooking the recommended dishes. Therefore, this method of recipe recommendation has a low utilization rate of the ingredients stored in the refrigerator.
[0101] To address the aforementioned problems, the inventive concept of this application is as follows: Obtain ingredient data stored in a storage device. Based on a deep Q-value network, determine the recommendation value of each recipe within a preset recipe set from the ingredient data. This recommendation value represents the user's satisfaction level with the recipe. The recommendation value is determined by the deep Q-value network from the recipe's ingredient data, identifying the action value and advantage value of the recipe. This allows for rapid determination of the recipe's recommendation value, and the resulting recommendation value better meets user needs. Furthermore, target recipes are determined based on the recommendation values of each recipe, and the recommendation frequency of each target recipe is obtained. Target recipes represent recipes that can be cooked using the stored ingredients. Finally, a recipe recommendation list is generated based on the recommendation frequency of the target recipes. Each target recipe in the resulting recipe recommendation list can be cooked using the stored ingredients, improving the utilization rate of the ingredients.
[0102] After introducing the design concept of the embodiments of this application, the following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of this application can be applied. It should be noted that the application scenarios described below are only for illustrating the embodiments of this application and are not intended to limit the scope. In specific implementation, the technical solutions provided by the embodiments of this application can be flexibly applied according to actual needs.
[0103] Specifically, such as Figure 1 The diagram illustrates an application scenario of the recipe recommendation list generation method provided in this embodiment of the application. This application scenario includes a user terminal 10, a refrigerator 20, and a server 30. The user terminal 10, refrigerator 20, and server 30 can be connected and transmit data via wired or wireless connections. For example, the user terminal 10, refrigerator 20, and server 30 can be connected via a data cable or a wired network; they can also be connected via an RF module, Bluetooth module, or wireless network.
[0104] The user terminal 10 can be a mobile phone, a PDA (Personal Digital Assistant), a tablet computer, etc. For example, a recipe recommendation application can be installed on the user terminal 10. The ingredient information of the candidate ingredients stored in the refrigerator 20 can be stored in the refrigerator 20. The ingredient information includes quantity information and shelf-life information. The user can trigger the recipe recommendation application on the user terminal 10, so that after the user terminal 10 obtains the ingredient information stored in the refrigerator 20, it sends a request to the server 30 to obtain recommended recipes and the ingredient information. After receiving the request, the server 30 generates a recipe recommendation list based on the received ingredient information. The server 30 sends the generated recipe recommendation list to the user terminal 10, so that the user terminal 10 can display the recipe recommendation list on the display interface for the user to select a recipe.
[0105] like Figure 2 As shown, this application illustrates another application scenario of the recipe recommendation list generation method provided in this embodiment. This application scenario includes a refrigerator 20 and a server 30. The refrigerator 20 and the server 30 can be connected and transmit data via a wired or wireless connection. For example, the refrigerator 20 and the server 30 can be connected via a data cable or a wired network; they can also be connected via an RF module, a Bluetooth module, or a wireless network.
[0106] The ingredient information of the candidate ingredients stored in refrigerator 20 can be stored either in refrigerator 20 or in server 30. Users can trigger the recipe recommendation application on refrigerator 20 to send a request to server 30 to retrieve a recipe recommendation list. Upon receiving the request, server 30 generates a recipe recommendation list based on the retrieved ingredient information and sends the generated list to refrigerator 20, allowing refrigerator 20 to display the recipe recommendation list in its display module for selection.
[0107] In other embodiments, the recipe recommendation list generation method provided in this application can also be applied to a refrigerator. In response to the user's operation of triggering the recipe recommendation application, the refrigerator generates a recipe recommendation list based on the ingredient information of candidate ingredients stored in the memory, and displays the recipe recommendation list in the display module for the user to select.
[0108] In other embodiments, the recipe recommendation list generation method provided in this application can also be executed by a user terminal. The ingredient information of candidate ingredients stored inside the refrigerator is stored within the refrigerator. The user can trigger a recipe recommendation application on their terminal, causing the terminal to respond to the user's trigger operation, retrieve the ingredient information stored in the refrigerator, and generate a recipe recommendation list based on the retrieved ingredient information. The user terminal can send the generated recipe recommendation list to the refrigerator, causing the refrigerator to display the recipe recommendation list on its display module for selection. Alternatively, the user terminal can display the generated recipe recommendation list on its display interface for the user to choose from.
[0109] To facilitate understanding of the recipe recommendation list generation method provided in this application, the specific implementation process of the recipe recommendation list generation method provided in this application embodiment is described below using a server as an example. It should be understood that the process of other electronic devices executing the recipe recommendation list generation method can also be performed with reference to the specific embodiments described below.
[0110] Figure 3a The overall flowchart of the method for generating a recipe recommendation list provided in the embodiments of this application includes:
[0111] Step 301: Obtain the food data already stored in the storage device;
[0112] It should be noted that the storage device in this application embodiment may include electronic devices such as smart refrigerators and smart freezers that have the ability to record food data of stored food.
[0113] In some possible embodiments, food data may include the types, quantities, and expiration dates of food already stored in the refrigerator. Specifically, after a user places food into the smart refrigerator, they can record the quantity and types of food already stored in the smart refrigerator. The smart refrigerator pre-stores the expiration dates of various food items (e.g., pre-stored expiration dates of common vegetables, meats, and fruits). The smart refrigerator records the food data for that item in the server based on the date of storage. For example... Figure 3b As shown, after a user places three tomatoes into the smart refrigerator, they can record this action via the refrigerator's display panel. The smart refrigerator adds the three tomatoes to its food database and records a shelf life of 5 days. After 24 hours, it automatically updates the food database, changing the shelf life to 4 days. Therefore, by reading the smart refrigerator's food database, the types, quantities, and shelf lives of the stored foods can be determined. In other words, the food data of the stored foods can be retrieved.
[0114] Step 302: Based on the deep Q-value network, determine the recommendation value of each recipe in the preset recipe set according to the ingredient data; wherein, the deep Q-value network includes multiple recommendation sub-networks for determining the recommendation value of the recipe, and the recommendation value is determined based on the action value and advantage value of the recipe.
[0115] First, let's explain the preset recipe set. A preset recipe set can be understood as a collection of recipes pre-stored in a smart refrigerator. In this application, the preset recipe set consists of 100 home-style dishes, each with a corresponding number. Specifically, as follows... Figure 3c As shown, for example, recipe #1 is shredded pork with garlic sauce, recipe #2 is stir-fried celery with pork, and so on... recipe #3 is scrambled eggs with tomatoes. In implementation, a feature matrix is first constructed based on the ingredient data and the feature vectors of the pre-stored ingredients. Specifically, in this embodiment, common ingredients on the market are used as pre-stored ingredients. The pre-stored ingredients can be 500 different common ingredients, and each ingredient has a 502-dimensional feature vector. The first 500 dimensions represent the compatibility and incompatibility relationships between this ingredient and other ingredients, and the values of the first 500 dimensions range from {-1, 0, 1}. -1 indicates that this ingredient is incompatible with other ingredients and cannot be eaten together; 0 indicates that this ingredient does not affect other ingredients, has no incompatibility or compatibility relationship; 1 indicates that this ingredient is compatible with other ingredients and is suitable to be paired with other ingredients. For example, the feature vector of spinach is... The meaning of this feature vector is as follows: spinach is best eaten with carrots (the value of the first dimension of the feature vector is 1), and should not be eaten with cucumbers (the value of the second dimension is -1). Whether to add chili peppers to the spinach is up to personal preference (the value of the 500th dimension is 0). There are two bunches of spinach left in the refrigerator (the value of the 501st dimension is 2), and the remaining shelf life is one day (the value of the 502nd dimension is 1). Therefore, the input to the deep Q-value network is a feature matrix of size 500.
[0116] The deep Q-value network of this application includes multiple recommendation subnetworks. Each recommendation subnetwork has the same input (the aforementioned feature matrix) and is independent of each other. Since the network parameters of each recommendation subnetwork are different, even if the same feature matrix is input into each recommendation subnetwork, the recommendation values output by each recommendation subnetwork will not be exactly the same.
[0117] In implementation, max pooling is performed on the output of the convolutional layers of the recommendation sub-network to control the network to obtain a 100-dimensional Q-value vector based on the feature matrix. This Q-value vector represents the recommended recipe value. For example, the Q-value vector is... The Q-value vector represents the recommended value of each recipe from 100 to the preset recipe set. The recommended value of the first dish, shredded pork with garlic sauce, stored in the preset recipe set is 7, and the recommended value of the 100th dish, scrambled eggs with tomatoes, is 2.
[0118] Since the existing ingredients in the smart refrigerator can be determined based on the input feature matrix, all recipes with non-zero Q values in the Q-value vector are recipes that can be cooked using the stored ingredients. Furthermore, each recommendation subnetwork outputs the recipe with the largest Q value in the corresponding Q-value vector as the target recipe output, which is the recipe that the recommendation subnetwork believes should be recommended to the user.
[0119] To improve the convergence speed and recommendation strategy quality of the recommendation subnetwork, the Q-value vector in this application is determined based on the action value V and the advantage value A of the recipe. Specifically, as follows... Figure 3d As shown, Figure 3d This is a schematic diagram of the recommended subnetwork structure, including convolutional layers and fully connected layers.
[0120] In implementation, this embodiment extracts the target vectors of each ingredient from the stored ingredients from the input feature matrix using a convolutional layer. Further, the convolutional layer outputs this target feature vector to a fully connected layer. The fully connected layer comprises a V-value module and an A-value module, used to extract the action value V and advantage value A corresponding to the recipe from the acquired target feature vector. Specifically, the A-value module consists of three fully connected layers with dimensions of 1024, 512, and 100, respectively. The structure of the V-value module is the same as the A-value module, but the dimensions are different. The dimensions of the V-value module are 64, 16, and 1, respectively. It should be understood that the preset recipe set contains a total of 100 dishes, and all recipes that can be cooked with the stored ingredients are within these 100 dishes. The 100-dimensional advantage vector output by the A-value module represents the value by which each recipe, when recommended to the user, exceeds the average expectation. Correspondingly, the recommendation value Q represents the user's expectation for the recipe, while the one-dimensional vector output by the V-value module represents the user's average expectation for recipes that can be cooked with the stored ingredients. After determining the action value V and advantage value A of the recipe through the V-value module and A-value module in the fully connected layer, the recommendation value Q of the recipe is determined according to the following formula (1):
[0121] Q(s, a) i ;θ,α,β)=V(s;θ,α)+A(s,a i ; θ, β), i={1, 2..., 99, 100} Formula (1)
[0122] Where θ represents the network parameters of the convolutional layer, α represents the network parameters of the V-value module, and β represents the network parameters of the A-value module; a i This represents the i-th recipe in the preset recipe set.
[0123] In recipe recommendation scenarios, there are many states (the feature matrix represents the current state). Whether a recipe is recommended or not has almost no impact on the next state transition. In these cases, calculating the action value function (i.e., the Q-value mentioned above) is less meaningful than calculating the action value V in the state function. This is mainly because, for example, if the stored ingredients for cooking recipes are all dishes the user likes, it means the user's average expectation for these recipes is high; that is, the action value V for each recipe will be a large value. In this case, regardless of which recipe is recommended, the user's expectation for the recipe will not differ much, i.e., the impact on the Q-value is very small. However, by extracting the advantage value A of a recipe to reflect the advantage of recommending that recipe over recommending others, the difference between the average expectation of each recipe and all recipes can be reflected, thereby improving the generalization ability of the neural network model and enabling the neural network model to converge quickly.
[0124] Step 303: Determine the target recipe based on the recommendation value of each recipe, and generate a recipe recommendation list based on the number of times the target recipe is recommended.
[0125] Considering that determining the target recipe through the ∈-greedy algorithm (greedy strategy) may result in the second-best and worst actions being recommended with equal probability, in order to alleviate this situation, after each recommendation subnetwork determines the recommendation value Q of each recipe in the preset recipe set, the Boltzmann formula is used to determine the recommendation probability P of each recipe, as shown in the following formula (2):
[0126]
[0127] Where j∈{1,...,100}. τ is a preset weighting coefficient. The larger τ is, the more inclined the recipe will be to be selected randomly. Conversely, the smaller τ is, the more inclined the recipe with the largest recommended value Q will be selected.
[0128] In some possible embodiments, the recommendation subnetwork, after obtaining the recommendation value Q for 100 recipes from a preset recipe set, determines the recommendation probability P of the 100 recipes based on the above formula (2). For example, for recipes A, B, and C, assuming their recommendation probabilities are 0.7, 0.2, and 0.1 respectively, a random number in the interval [0, 1] is generated. If the random number falls in the interval [0, 0.7], then recipe A is determined as the target recipe; if the random number falls in the interval (0.7, 0.9), then recipe B is determined as the target recipe. Correspondingly, if the random number falls in the interval (0.9, 1), then recipe C is determined as the target recipe. This can alleviate the situation where the second-best action (i.e., B) and the worst action (i.e., C) are recommended with equal probability.
[0129] In this embodiment, τ is a function based on the number of times the deep Q-value network is used, t, and its definition is shown in the following formula (3):
[0130] τ(t)=max(1-0.001t,0.001) Formula (3)
[0131] Therefore, in the early stages, the deep Q-value network in this embodiment tends to randomly recommend dishes to the user in order to quickly determine the user's taste preferences. As the number of times the user uses the dish increases (i.e., the t-value increases), the deep Q-value network increasingly tends to recommend dishes that the user frequently eats. The more times a user selects a particular recipe, the greater the probability that recipe will be selected later. Furthermore, considering that users may suddenly want to try new dishes or change their tastes, even if each recipe is recommended many times (i.e., frequently eaten by the user), the probability P will never be 1.
[0132] In this embodiment, the network parameters of each recommendation sub-network are different, so the output results will not be exactly the same. For example, if there are 500 recommendation sub-networks in a deep Q-value network, then after inputting the feature matrix of the stored ingredients into this deep Q-value network, each recommendation sub-network will output 500 target recipes. Specifically, as follows... Figure 3e As shown in the figure, a is shown i,j This represents the j-th recipe in the preset recipe set output by the i-th recommendation subnetwork. For example, a 1,1 This indicates that the first recommended subnetwork outputs shredded pork with garlic sauce, a 2,78 This indicates that the Mala Xiang Guo (Spicy Stir-Fry) is the output of the second recommendation sub-network. Specifically, the first recipe in the preset recipe set, Yu Xiang Rou Si (Fish-Flavored Shredded Pork), is output by the first recommendation sub-network, and the 78th recipe, Mala Xiang Guo, is output by the second recommendation sub-network.
[0133] Therefore, by statistically analyzing the target recipe sets output by each recommendation sub-network, the number of times each target recipe is recommended can be determined. Furthermore, a recommended recipe list is generated based on the recommendation frequency of each target recipe, resulting in a list of recipes that best meet user expectations. In implementation, the target recipes output by each recommendation sub-network are first determined, and the number of times each target recipe is recommended is counted. Finally, a recommended recipe list is generated based on the target recipes whose recommendation frequency meets preset requirements.
[0134] Specifically, recommendation thresholds can be pre-set. For example, if 500 recommendation sub-modules identify 27 target recipes with a recommendation threshold of 10, and all target recipes except for scrambled eggs with tomatoes (which was recommended 3 times, less than the threshold) have recommendation counts greater than the threshold, then the target recipes with recommendation counts greater than the threshold are sorted in descending order of recommendation count to generate a recommended list. Since the target recipes in the above recommended list are filtered using recommendation thresholds, it effectively reduces the likelihood of recommending target recipes that do not meet the actual user's expectations (i.e., recipes with recommendation counts less than the threshold) to the user.
[0135] In addition, the number of recipes n in the recipe recommendation list can be preset, where n is a positive integer. After determining the target recipes output by each recommendation subnetwork, the target recipes are sorted from most to least recommended, and the top n target recipes in this sort are selected as the recipes in the recipe recommendation list.
[0136] Through the above process, the smart refrigerator generates a list of recommended recipes for the user based on the stored ingredients, and then outputs this list to a display screen for the user to view. Specifically, as follows... Figure 3fAs shown, for example, if a refrigerator contains ten ingredients such as tomatoes, eggs, and celery, based on the ingredient data of these ten stored ingredients, 20 recipes can be determined, including: scrambled eggs with tomatoes, tomato and egg soup, and stir-fried celery with meat. Each recommendation subnetwork outputs three target recipes: scrambled eggs with tomatoes, tomato and egg soup, and stir-fried celery with meat. Specifically, scrambled eggs with tomatoes is recommended 300 times, tomato and egg soup is recommended 200 times, and stir-fried celery with meat is recommended 100 times. A recipe recommendation list is then generated based on these three target recipes, sorted in descending order of the number of times each target recipe is recommended, and then displayed to the user.
[0137] Figure 4 This is a schematic diagram of the structure of a storage device provided in an embodiment of this application; as shown below. Figure 4 As shown in the embodiment of this application, the storage device 100 includes: a processor 101, a display 102, a memory 103, an input device 106, a bus 105, and a communication module 104; the processor 101, memory 103, input device 106, display 102, and communication module 104 are all connected through the bus 105, which is used for data transmission between the processor 101, memory 103, display 102, communication module 104, and input device 106.
[0138] The memory 103 can be used to store software programs and modules, such as the program instructions / modules corresponding to the recipe recommendation list generation method in this embodiment. The processor 101 executes various functional applications and data processing of the storage device 100 by running the software programs and modules stored in the memory 103, such as the recipe recommendation list generation method provided in this embodiment. The memory 103 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs of at least one application, etc.; the data storage area may store data created according to the use of the storage device 100 (such as a preset recipe set, preset feature vectors corresponding to various ingredients, and sample data). In addition, the memory 103 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0139] The processor 101 is the control center of the storage device 100. It connects to various parts of the storage device 100 via the bus 105 and various interfaces and lines. It performs various functions of the storage device 100 and processes data by running or executing software programs and / or modules stored in the memory 103 and calling data stored in the memory 103. Optionally, the processor 101 may include one or more processing units, such as a CPU, GPU, digital processing unit, etc.
[0140] The processor 101 can display the processing results of the molecular structure diagram to the user via the display 102.
[0141] The processor 101 can also connect to the network via the communication module 104 to obtain recommended recipes selected by the user.
[0142] Input device 106 is mainly used to obtain user input operations. The input device 106 may also be different depending on the storage device. For example, when the storage device is a computer, the input device 106 can be an input device such as a mouse or keyboard; when the storage device is a smartphone, tablet computer or other portable device, the input device 106 can be a touch screen.
[0143] Based on the same inventive concept, this application also provides a recipe recommendation device. Since the principle of this device in solving the problem is similar to the method of generating the recipe recommendation list in this application, the implementation of this device can refer to the implementation of the method, and the repeated parts will not be described again.
[0144] like Figure 5 As shown in the figure, this application provides a recipe recommendation list generation device, including:
[0145] The ingredient data determination module 501 is configured to retrieve the ingredient data already stored in the storage device;
[0146] The recommendation value acquisition module 502 is configured to execute a deep Q-value network to determine the recommendation value of each recipe in the preset recipe set based on the ingredient data; wherein, the deep Q-value network includes multiple recommendation sub-networks for determining the recommendation value of the recipe, and the recommendation value is determined based on the action value and advantage value of the recipe;
[0147] The recommendation list generation module 503 is configured to determine the target recipe based on the recommendation value of each recipe, and generate a recipe recommendation list based on the number of times the target recipe is recommended.
[0148] In some possible embodiments, the process of determining the target recipe based on the recommendation values of each recipe is performed, and the recommendation list generation module is configured to:
[0149] A feature matrix is constructed based on the ingredient data and the feature vectors of pre-stored ingredients; wherein, the pre-stored ingredients include the already stored ingredients;
[0150] Based on the feature matrix, the recommendation value of each recipe in the preset recipe set is determined through each of the recommendation sub-networks;
[0151] The recipe corresponding to the maximum value among the recommended values determined by each of the aforementioned recommendation sub-networks is taken as the target recipe.
[0152] In some possible embodiments, the recommendation subnetwork includes convolutional layers and fully connected layers, and the action value and advantage value of the target recipe are determined in the following manner:
[0153] For each of the recommendation subnetworks, the target vector corresponding to the feature matrix is determined by the convolutional layer based on the feature matrix;
[0154] Based on the target vector, the action value and advantage value corresponding to each recipe in the preset recipe set are determined through the fully connected layer; wherein, the preset recipe set includes the target recipe.
[0155] In some possible embodiments, the recommended values for each recipe are determined in the following ways:
[0156] For each recipe, the sum of the action value and the advantage value is used as the recommended value for that recipe.
[0157] In some possible embodiments, the process of determining the target recipe based on the recommendation values of each recipe is performed, and the recommendation list generation module is configured to:
[0158] Based on the recommendation values of each recipe, the recommendation probability of each recipe is determined using the Boltzmann distribution;
[0159] The target recipe is determined based on the recommendation probability.
[0160] In some possible embodiments, the process of generating a recipe recommendation list based on the number of recommendations of the target recipe is performed, and the recommendation list generation module is configured to:
[0161] The number of times each target recipe is output by the recommendation subnetwork is counted, and the number of times each target recipe is output is taken as the recommendation number.
[0162] The recommended recipe list is generated based on the target recipes that meet the preset requirements in terms of the number of recommendations.
[0163] In some possible embodiments, the process of generating the recipe recommendation list based on the target recipes that meet a preset requirement in terms of the number of recommendations is performed. The recommendation list generation module is configured to:
[0164] The target recipes whose recommendation frequency exceeds the recommendation threshold are designated as recipes to be recommended, and a recipe recommendation list is generated according to the recommendation frequency of each recipe to be recommended in descending order; or,
[0165] The target recipes are sorted in descending order of their recommendation frequency, and the top n target recipes are selected from the sorted list.
[0166] The recommended list of recipes is generated based on the first n target recipes; where n is a positive integer.
[0167] This application also provides a computer storage medium storing computer-executable instructions for implementing the recipe recommendation list generation method described in any embodiment of this application.
[0168] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0169] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0170] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0171] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0172] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method of generating a recipe recommendation list, characterized by, The method comprises: acquiring food material data of stored food materials in a storage device; determining recommendation values of each recipe in a preset recipe set according to the food material data based on a deep Q value network; wherein the deep Q value network comprises a plurality of recommendation sub-networks for determining recipe recommendation values, and the recommendation value is determined based on an action value and an advantage value of the recipe; determining a target recipe according to the recommendation values of each recipe, and counting the target recipe output by each recommendation sub-network, and taking the output times of each target recipe as recommendation times; generating the recipe recommendation list according to the target recipe whose recommendation times meet a preset requirement; determining the target recipe according to the recommendation values of each recipe comprises: constructing a feature matrix based on the food material data and the feature vectors of pre-stored food materials; wherein the pre-stored food materials include the stored food materials; determining the recommendation value of each recipe in the preset recipe set through each recommendation sub-network based on the feature matrix; and taking the recipe corresponding to the maximum value in the recommendation value determined by each recommendation sub-network as the target recipe.
2. The method of claim 1, wherein, The recommendation sub-network comprises a convolution layer and a fully connected layer, and the action value and the advantage value of the target recipe are determined in the following manner: for each recommendation sub-network, determining a target vector corresponding to the feature matrix through the convolution layer based on the feature matrix; determining the action value and the advantage value corresponding to each recipe in the preset recipe set through the fully connected layer based on the target vector; wherein the preset recipe set includes the target recipe.
3. The method according to claim 1 or 2, characterized in that, The recommendation value of each recipe is determined in the following manner: for each recipe, taking the sum of the action value and the advantage value as the recommendation value of the recipe.
4. The method of claim 3, wherein, Determining the target recipe according to the recommendation values of each recipe comprises: determining the recommendation probability of each recipe using the Boltzmann distribution based on the recommendation values of each recipe; determining the target recipe based on the recommendation probability.
5. The method of claim 1, wherein, Generating the recipe recommendation list according to the target recipe whose recommendation times meet a preset requirement comprises: taking the target recipe whose recommendation times are greater than a recommendation threshold as a recipe to be recommended, and generating the recipe recommendation list in the order from more to less according to the recommendation times of each recipe to be recommended; or sorting each target recipe in the order from more to less according to the recommendation times, and selecting the first n target recipes from the sorting; generating the recipe recommendation list according to the first n target recipes; wherein n is a positive integer.
6. A storage device, comprising: It comprises: a display, a memory and a controller, wherein: the display is used to display information; the memory is used to store computer programs that can be executed by the controller; the controller is connected to the display and the memory respectively, and is configured to: acquire food material data of stored food materials; determine recommendation values of each recipe in a preset recipe set according to the food material data based on a deep Q value network; wherein the deep Q value network comprises a plurality of recommendation sub-networks for determining recipe recommendation values, and the recommendation value is determined based on an action value and an advantage value of the recipe; determine target recipes according to the recommendation values of the recipes, count the target recipes output by each of the recommendation sub-networks, and take the output times of each target recipe as recommendation times; generate the recipe recommendation list according to the target recipes that meet preset requirements in terms of the recommendation times; The controller is configured to: construct a feature matrix based on the ingredient data and feature vectors of pre-stored ingredients, wherein the pre-stored ingredients include the stored ingredients; determine the recommendation values of each recipe in the preset recipe set by each of the recommendation sub-networks based on the feature matrix; and take the recipe corresponding to the maximum value in the recommendation values determined by each of the recommendation sub-networks as the target recipe.
7. An apparatus for generating a recipe recommendation list, the apparatus comprising: The apparatus comprises: an ingredient data determination module configured to perform the acquisition of the ingredient data of the stored ingredients in the storage device; a recommendation value acquisition module configured to perform the determination of the recommendation values of each recipe in the preset recipe set based on a deep Q value network according to the ingredient data, wherein the deep Q value network comprises multiple recommendation sub-networks for determining the recommendation values of recipes, and the recommendation values are determined based on action values and advantage values of the recipes; a recommendation list generation module configured to perform the determination of target recipes according to the recommendation values of the recipes, count the target recipes output by each of the recommendation sub-networks, and take the output times of each target recipe as recommendation times; generate the recipe recommendation list according to the target recipes that meet preset requirements in terms of the recommendation times; The recommendation value acquisition module is configured to: construct a feature matrix based on the ingredient data and feature vectors of pre-stored ingredients, wherein the pre-stored ingredients include the stored ingredients; determine the recommendation values of each recipe in the preset recipe set by each of the recommendation sub-networks based on the feature matrix; and take the recipe corresponding to the maximum value in the recommendation values determined by each of the recommendation sub-networks as the target recipe.
8. A computer-readable storage medium having stored therein a computer program, characterized in that, The computer program, when executed by a processor, implements the method of any one of claims 1-5.
Citation Information
Patent Citations
Recipe recommendation method, recipe recommendation device and refrigerator
CN107423421A