Recommendation method and device based on graph computing, storage medium and electronic device
Through the recommendation method based on graph calculation, using knowledge graphs and dynamic programming algorithms, the problem that the existing recommendation method cannot comprehensively consider the multi-dimensional factors of resource objects, and efficient and accurate resource object recommendations are achieved.
Patent Information
- Application Number
- CN202210269207.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-18
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2042-03-18
AI Technical Summary
The existing resource object recommendation method cannot comprehensively consider the various dimension factors of the resource object, resulting in the recommendation results that cannot meet the needs of users.
The recommendation method based on graph calculation is adopted, and the pre-constructed knowledge graph of the object to be recommended is obtained, and the dynamic programming conditions are met, and the graph calculation is calculated using a preset dynamic programming algorithm to obtain a recommendation score.
This method can effectively improve the speed of graph calculation, save the computing resources of the equipment, improve the recommendation efficiency, and meet the recommendation needs of users.
Smart Images

Figure CN114676321B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a recommendation method and device based on graph computing, a storage medium and an electronic device. Background Art
[0002] With the development of Internet technology, resource object recommendation is increasingly widely used. In the existing resource object recommendation process, content-based recommendation and collaborative filtering recommendation are usually adopted. However, the existing recommendation methods often fail to comprehensively consider various dimensional factors of resource objects to score resource objects, resulting in recommendation results that cannot meet user recommendation needs. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a recommendation method based on graph computing, which can meet the recommendation needs of users.
[0004] The present invention also provides a recommendation device based on graph computing to ensure the implementation and application of the above method in practice.
[0005] A recommendation method based on graph computing, comprising:
[0006] In response to the recommendation instruction, determining each object to be recommended;
[0007] Obtaining a pre-built knowledge graph for each of the objects to be recommended;
[0008] Determine whether the knowledge graph of each of the objects to be recommended meets the preset dynamic programming conditions;
[0009] For each of the objects to be recommended, if the knowledge graph of the object to be recommended meets the dynamic programming conditions, a preset dynamic programming algorithm is applied to perform graph calculation on the knowledge graph of the object to be recommended to obtain a recommendation score for the object to be recommended;
[0010] The objects to be recommended that have obtained the recommendation scores are determined as target objects to be recommended, and each of the target objects to be recommended is recommended according to the recommendation scores of each of the target objects to be recommended.
[0011] In the above method, optionally, obtaining a pre-built knowledge graph of each object to be recommended includes:
[0012] Determining the object identification of each of the objects to be recommended;
[0013] A pre-set graph database is queried based on the object identification of each object to be recommended to obtain a pre-built knowledge graph for each object to be recommended.
[0014] In the above method, optionally, the step of determining whether the knowledge graph of each object to be recommended satisfies a preset dynamic programming condition includes:
[0015] Determine whether the optimal solution to the shortest path problem of the knowledge graph of each object to be recommended satisfies the optimal substructure property, and whether there are overlapping subproblems in the subproblems of the shortest path problem of each knowledge graph of the object to be recommended;
[0016] For each object to be recommended, if the optimal solution to the shortest path problem of the knowledge graph of the object to be recommended satisfies the optimal substructure property, and there are overlapping subproblems in the subproblems of the shortest path problem of the knowledge graph of the object to be recommended, it is determined that the knowledge graph of the object to be recommended satisfies the preset dynamic programming conditions; otherwise, it is determined that the object to be recommended does not satisfy the dynamic programming conditions.
[0017] In the above method, optionally, the applying of a preset dynamic programming algorithm to perform graph calculation on the knowledge graph of the object to be recommended to obtain a recommendation score of the object to be recommended includes:
[0018] Determine each sub-problem of the shortest path problem of the knowledge graph of the object to be recommended according to a preset dynamic programming algorithm;
[0019] Obtain a record table corresponding to the knowledge graph; the record table is used to record the solutions to each sub-problem of the shortest path problem of each knowledge graph;
[0020] Solve the sub-problems of the shortest path problem in sequence based on the record table to obtain an optimal solution to the shortest path problem;
[0021] A recommendation score for the object to be recommended is obtained based on the optimal solution of the path.
[0022] The above method, optionally, solving each of the sub-problems of the shortest path problem in sequence based on the record table to obtain the optimal path solution of the shortest path problem includes:
[0023] For each of the subproblems, if the subproblem is the first subproblem, check whether there is a solution to a historical subproblem that is consistent with the subproblem in the record table; if so, take the solution to the historical subproblem as the solution to the subproblem, and determine the optimal path value of the subproblem based on the solution to the subproblem; if the subproblem is not the first subproblem, check whether there is a solution to a historical subproblem that is consistent with the subproblem in the record table; if so, take the solution to the historical subproblem as the solution to the subproblem, and determine the optimal path value of the subproblem based on the solution to the subproblem and the optimal path value of the previous subproblem of the subproblem;
[0024] The optimal path value of the last subproblem in each of the subproblems is determined as the optimal path solution of the shortest path problem.
[0025] In the above method, optionally, the step of recommending each of the target objects to be recommended according to the recommendation score of each of the target objects to be recommended includes:
[0026] Sorting each of the target objects to be recommended in descending order of their recommendation scores;
[0027] Recommend each of the target objects to be recommended based on the ranking of each of the target objects to be recommended.
[0028] A recommendation device based on graph computing, comprising:
[0029] A determination unit, used to respond to the recommendation instruction and determine each object to be recommended;
[0030] An acquisition unit, used to acquire a pre-built knowledge graph for each object to be recommended;
[0031] A judgment unit, used to judge whether the knowledge graph of each object to be recommended meets a preset dynamic programming condition;
[0032] a computing unit, configured to, for each of the objects to be recommended, apply a preset dynamic programming algorithm to perform graph computing on the knowledge graph of the object to be recommended, if the knowledge graph of the object to be recommended satisfies the dynamic programming condition, to obtain a recommendation score for the object to be recommended;
[0033] The recommendation unit is used to determine the recommended objects that have obtained the recommendation score as target recommended objects, and recommend each target recommended object according to the recommendation score of each target recommended object.
[0034] In the above device, optionally, the acquisition unit includes:
[0035] A determination subunit, used to determine the object identifier of each object to be recommended;
[0036] The query subunit is used to query a pre-set graph database based on the object identification of each object to be recommended, so as to obtain a pre-built knowledge graph of each object to be recommended.
[0037] A storage medium includes storage instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned graph-based computing recommendation method.
[0038] An electronic device includes a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to perform the above-mentioned graph-based calculation recommendation method.
[0039] Compared with the prior art, the present invention has the following advantages:
[0040] The present invention provides a recommendation method and device based on graph calculation, a storage medium and an electronic device, the method comprising: in response to a recommendation instruction, determining each object to be recommended; obtaining a pre-constructed knowledge graph of each object to be recommended; judging whether the knowledge graph of each object to be recommended satisfies a preset dynamic programming condition; for each object to be recommended, if the knowledge graph of the object to be recommended satisfies the dynamic programming condition, applying a preset dynamic programming algorithm to perform graph calculation on the knowledge graph of the object to be recommended to obtain a recommendation score of the object to be recommended; determining the object to be recommended that has obtained the recommendation score as the target object to be recommended, and recommending each target object to be recommended according to the recommendation score of each target object to be recommended. The method provided by the embodiment of the present invention can score and recommend the object to be recommended based on the knowledge graph, can meet the recommendation needs of users, and can perform graph calculation on the knowledge graph through the dynamic programming algorithm, effectively improving the speed of graph calculation, saving computing resources of the device, and improving recommendation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0042] Figure 1 A method flow chart of a recommendation method based on graph computing provided by the present invention;
[0043] Figure 2 A flowchart of a process of obtaining a pre-built knowledge graph for each object to be recommended provided by the present invention;
[0044] Figure 3 A flow chart of a dynamic programming algorithm applicability determination process provided by the present invention;
[0045] Figure 4 A flowchart of a graph calculation process provided by the present invention;
[0046] Figure 5A schematic diagram of the structure of a recommendation device based on graph computing provided by the present invention;
[0047] Figure 6 The present invention provides a schematic structural diagram of an electronic device. DETAILED DESCRIPTION
[0048] 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.
[0049] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0050] Existing recommendation methods often fail to comprehensively consider various dimensional factors of resource objects to score resource objects, resulting in recommendation results that cannot meet user recommendation needs. In a feasible implementation, knowledge graphs can be used for graph computing to determine the recommendation scores of resource objects. However, when the knowledge graph of a resource object is updated, the entire knowledge graph needs to be recalculated, which consumes a lot of time and computing resources.
[0051] Based on this, an embodiment of the present invention provides a recommendation method based on graph computing, which can be applied to electronic devices. The method flow chart of the method is as follows: Figure 1 As shown, specifically including:
[0052] S101: In response to a recommendation instruction, determine each object to be recommended.
[0053] In this embodiment, the object to be recommended may be a supplier or a carrier of the product.
[0054] S102: Obtain a pre-built knowledge graph for each object to be recommended.
[0055] In this embodiment, the knowledge graph includes multiple nodes and associated edges between each of the nodes; the nodes may include descriptive information of the object to be recommended, for example, it may include one or more information such as order quantity, price, processing time and fulfillment status; the associated edges are set with weight information.
[0056] S103: Determine whether the knowledge graph of each object to be recommended meets the preset dynamic programming conditions.
[0057] In this embodiment, the shortest path problem corresponding to the recommendation score of the object to be recommended can be determined based on the knowledge graph, and whether the knowledge graph of the object to be recommended meets the dynamic programming conditions can be judged based on the shortest path problem of the knowledge graph.
[0058] S104: For each of the objects to be recommended, if the knowledge graph of the object to be recommended meets the dynamic programming conditions, a preset dynamic programming algorithm is applied to perform graph calculation on the knowledge graph of the object to be recommended to obtain a recommendation score for the object to be recommended.
[0059] In this embodiment, a preset dynamic programming algorithm is applied to perform graph calculation on the knowledge graph of the object to be recommended, so as to calculate the shortest path between nodes in the knowledge graph, thereby obtaining a recommendation score of the object to be recommended.
[0060] In some embodiments, when the knowledge graph of the object to be recommended does not meet the dynamic programming conditions, the knowledge graph can be calculated based on a preset graph algorithm to obtain a recommendation score for the object to be recommended. The graph algorithm can be a shortest path algorithm.
[0061] S105: Determine the objects to be recommended that have obtained the recommendation scores as target objects to be recommended, and recommend each target object to be recommended according to the recommendation scores of each target object to be recommended.
[0062] In this embodiment, the object identification of the object to be recommended and the recommendation score of the object to be recommended may be displayed on a preset display interface, thereby completing the recommendation of the object to be recommended.
[0063] By applying the method provided in the embodiment of the present invention, it is possible to score and recommend recommended objects based on the knowledge graph, meet the recommendation needs of users, and perform graph calculations on the knowledge graph through a dynamic programming algorithm, which effectively improves the speed of graph calculations, saves the computing resources of the device, and improves the recommendation efficiency.
[0064] In an embodiment provided by the present invention, based on the above implementation process, optionally, the pre-constructed knowledge graph of each object to be recommended is obtained, such as Figure 2 As shown, this may include:
[0065] S201: Determine the object identifier of each object to be recommended.
[0066] In this embodiment, the object identifier may be at least one of a user name or an identification code of the object to be recommended, and different objects to be recommended have different object identifiers.
[0067] S202: Query a pre-set graph database based on the object identification of each object to be recommended to obtain a pre-built knowledge graph for each object to be recommended.
[0068] In this embodiment, the correspondence between the object identifier and the knowledge graph is pre-recorded in the graph database, and the knowledge graph corresponding to the object identifier can be obtained in the graph database, and the knowledge graph is the knowledge graph of the object to be recommended.
[0069] In an embodiment provided by the present invention, based on the above implementation process, optionally, the step of determining whether the knowledge graph of each object to be recommended satisfies a preset dynamic programming condition includes:
[0070] Determine whether the optimal solution to the shortest path problem of the knowledge graph of each object to be recommended satisfies the optimal substructure property, and whether there are overlapping subproblems in the subproblems of the shortest path problem of each knowledge graph of the object to be recommended;
[0071] For each object to be recommended, if the optimal solution to the shortest path problem of the knowledge graph of the object to be recommended satisfies the optimal substructure property, and there are overlapping subproblems in the subproblems of the shortest path problem of the knowledge graph of the object to be recommended, it is determined that the knowledge graph of the object to be recommended satisfies the preset dynamic programming conditions; otherwise, it is determined that the object to be recommended does not satisfy the dynamic programming conditions.
[0072] Applying the method provided in this embodiment, the shortest path problem of the knowledge graph can be a problem of calculating the shortest path between two nodes in the knowledge graph, that is, it can be the objective equation of the shortest path between the two nodes, and the shortest path problem can be divided into sub-problems in multiple stages; the optimal substructure property can be that the optimal solution to the shortest path problem contains the optimal solution to the sub-problem of the shortest path problem.
[0073] Optionally, the existence of overlapping sub-problems in each sub-problem may refer to the existence of at least one set of repeated sub-problems in each sub-problem.
[0074] In an embodiment provided by the present invention, based on the above implementation process, optionally, the applying a preset dynamic programming algorithm to perform graph calculation on the knowledge graph of the object to be recommended to obtain a recommendation score of the object to be recommended includes:
[0075] Determine each sub-problem of the shortest path problem of the knowledge graph of the object to be recommended according to a preset dynamic programming algorithm;
[0076] Obtain a record table corresponding to the knowledge graph; the record table is used to record the solutions to each sub-problem of the shortest path problem of each knowledge graph;
[0077] Solving the sub-problems of the shortest path problem in sequence according to a preset order based on the record table to obtain an optimal solution to the shortest path problem;
[0078] A recommendation score for the object to be recommended is obtained based on the optimal solution of the path.
[0079] In this embodiment, the dynamic programming algorithm may be a shortest path algorithm based on the Bellman equation.
[0080] Optionally, the record table can record the solutions to each sub-problem of the shortest path problem in the knowledge graph. Each time a sub-problem is solved, the solution to the sub-problem can be recorded in the record table, so that when the same sub-problem is encountered again, the solution to the sub-problem can be obtained from the record table without recalculating. If the knowledge graph is partially updated, in the process of calculating the shortest path, the sub-problem corresponding to the updated part of the graph data can be re-solved without re-solving all the sub-problems of the updated knowledge graph, which saves device computing power and improves the speed of graph calculation.
[0081] In an embodiment provided by the present invention, based on the above implementation process, optionally, solving each of the sub-problems of the shortest path problem in sequence based on the record table to obtain the optimal path solution of the shortest path problem includes:
[0082] For each of the subproblems, if the subproblem is the first subproblem, check whether there is a solution to a historical subproblem that is consistent with the subproblem in the record table; if so, take the solution to the historical subproblem as the solution to the subproblem, and determine the optimal path value of the subproblem based on the solution to the subproblem; if the subproblem is not the first subproblem, check whether there is a solution to a historical subproblem that is consistent with the subproblem in the record table; if so, take the solution to the historical subproblem as the solution to the subproblem, and determine the optimal path value of the subproblem based on the solution to the subproblem and the optimal path value of the previous subproblem of the subproblem;
[0083] The optimal path value of the last subproblem in each of the subproblems is determined as the optimal path solution of the shortest path problem.
[0084] In an embodiment provided by the present invention, based on the above implementation process, optionally, recommending each of the target objects to be recommended according to the recommendation score of each of the target objects to be recommended includes:
[0085] Sorting each of the target objects to be recommended in descending order of their recommendation scores;
[0086] Recommend each of the target objects to be recommended based on the ranking of each of the target objects to be recommended.
[0087] In this embodiment, the target objects to be recommended and the recommendation score of each recommended object may be displayed on a pre-displayed interface according to the ranking of each target object to be recommended.
[0088] The recommendation method based on graph computing provided in this embodiment can be applied in a variety of fields. For example, it can be used to recommend a carrier to a user, or it can be used to recommend a supplier to a user. The following uses the examples of recommending a carrier to a user and recommending a supplier to a user as examples:
[0089] First, the process of recommending carriers to users can be as follows:
[0090] Step A1: You can collect all relevant data and key indicators such as shippers, carriers, historical transaction logistics information, etc.
[0091] Step A2: Build a knowledge graph based on the full dimensions of shippers and goods-carriers.
[0092] In this embodiment, the basic information of the carrier registered in the logistics center can be extracted, including basic information such as the shipper's company name, contact information, and registration region; the service method information of the shipper's current shipment can be extracted, including payment method, quotation, service method, etc.; the carrier's historical order information can be extracted, including fulfillment status, waybill volume, and the number of waybills on the same route.
[0093] Optionally, the carrier's influencing factors may include historical data factors and real-time data factors; historical data factors may include positively correlated factors such as order volume, successful delivery rate and track compliance rate, and real-time data factors may include negatively correlated factors such as quotation, shipper's recent choice, quotation response time and region.
[0094] Among them, the order volume is the total number of orders received by the carrier in history; the delivery rate refers to the normal receipt volume / total number of orders received; the track compliance rate refers to the qualified tracks / total number of tracks; the quotation refers to the price quoted by the carrier; the shipper's recent choice refers to the real-time logistics query of the carrier with the largest number of completed orders for each shipper; the quotation response time refers to the carrier's quotation time - the shipper's release time; the region refers to the carrier's regional factors, such as the distance between the carrier's registered place and the shipper's shipping place.
[0095] Step A3: Construct a carrier knowledge graph based on the extracted basic information, service information and historical waybill information of the carrier.
[0096] Step A4: Store the constructed graph model into the graph database.
[0097] Step A5: Build a neural network model based on the graph database, obtain the vector expression of each node in the network, and generate an intelligent recommendation model.
[0098] Step A6: When a cargo owner releases a new source of cargo, a dynamic programming algorithm is applied in the recommendation model to perform graph calculation on the carrier’s knowledge graph to obtain the carrier’s recommendation score, which is then sorted from high to low and displayed to the user.
[0099] Second, the process of recommending suppliers to users can be as follows:
[0100] Step B1: Normalize the influencing factors, purchasing users, and supplier initialization data and construct a knowledge graph.
[0101] Step B2: Store the knowledge graph into the graph database and build a graph database of purchasing users, products and suppliers.
[0102] Step B3: Build a graph-based neural network model, calculate the vector expression and loss function of each node in the graph network, and generate a recommendation model.
[0103] Step B4: When a purchasing user searches or places a demand order, based on the dimension selected by the user (comprehensive or single score), a dynamic programming algorithm is applied in the recommendation model to perform graph calculation on the knowledge graph of the carrier, obtain the recommended score of the carrier, sort it from high to low according to the score, and display it to the user.
[0104] In one embodiment of the present invention, before calculating the knowledge graph, the applicability of the dynamic programming algorithm can be judged. Figure 3 As shown, it is possible to determine whether the graph data of the knowledge graph satisfies the optimal substructure property and whether the graph data satisfies the subproblem overlapping property. When the graph data satisfies the optimal substructure property, it is determined that the graph data can implement decision-making in segments; when the graph data satisfies the subproblem overlapping property, it is determined that the graph data can adopt dynamic programming; when both of the above judgments are met, graph calculation is performed. The process of graph calculation is as follows Figure 4 As shown, we can find out the properties of the optimal solution and characterize its structural characteristics. We can recursively define the optimal value according to Bellman's idea, calculate the optimal value in a bottom-up manner, and obtain the final path optimal solution, i.e. the shortest path, through the calculated optimal value in time.
[0105] and Figure 1 Corresponding to the method described above, an embodiment of the present invention further provides a recommendation device based on graph computing, for Figure 1 In the specific implementation of the method, the recommendation device based on graph computing provided by the embodiment of the present invention can be applied to electronic devices, and its structural diagram is as follows Figure 5 As shown, specifically including:
[0106] A determination unit 501 is used to respond to the recommendation instruction and determine each object to be recommended;
[0107] An acquisition unit 502 is used to acquire a pre-built knowledge graph of each object to be recommended;
[0108] A judging unit 503 is used to judge whether the knowledge graph of each of the objects to be recommended meets a preset dynamic programming condition;
[0109] A calculation unit 504 is used for, for each of the objects to be recommended, applying a preset dynamic programming algorithm to perform graph calculation on the knowledge graph of the object to be recommended when the knowledge graph of the object to be recommended meets the dynamic programming condition, so as to obtain a recommendation score of the object to be recommended;
[0110] The recommendation unit 505 is used to determine the objects to be recommended that have obtained the recommendation score as target objects to be recommended, and recommend each target object to be recommended according to the recommendation score of each target object to be recommended.
[0111] In an embodiment provided by the present invention, based on the above solution, optionally, the acquisition unit 502 includes:
[0112] A determination subunit, used to determine the object identifier of each object to be recommended;
[0113] The query subunit is used to query a pre-set graph database based on the object identification of each object to be recommended, so as to obtain a pre-built knowledge graph of each object to be recommended.
[0114] In an embodiment provided by the present invention, based on the above solution, optionally, the judging unit 503 includes:
[0115] A judgment subunit, used to judge whether the optimal solution of the shortest path problem of each of the knowledge graphs of the object to be recommended satisfies the optimal substructure property, and whether there are overlapping subproblems in the various subproblems of the shortest path problem of each of the knowledge graphs of the object to be recommended;
[0116] The first execution sub-unit is used to determine, for each of the objects to be recommended, that the knowledge graph of the object to be recommended satisfies a preset dynamic programming condition when the optimal solution of the shortest path problem of the knowledge graph of the object to be recommended satisfies the optimal substructure property and there are overlapping sub-problems in the sub-problems of the shortest path problem of the knowledge graph of the object to be recommended; otherwise, determine that the object to be recommended does not satisfy the dynamic programming condition.
[0117] In an embodiment provided by the present invention, based on the above solution, optionally, the calculation unit 504 includes:
[0118] A second execution subunit is used to determine each sub-problem of the shortest path problem of the knowledge graph of the object to be recommended according to a preset dynamic programming algorithm;
[0119] An acquisition subunit, used to acquire a record table corresponding to the knowledge graph; the record table is used to record the solutions of each sub-problem of the shortest path problem of each knowledge graph;
[0120] A third execution subunit is used to solve the sub-problems of the shortest path problem in sequence based on the record table to obtain an optimal path solution for the shortest path problem;
[0121] The fourth execution subunit is used to obtain a recommendation score for the object to be recommended based on the optimal path solution.
[0122] In an embodiment provided by the present invention, based on the above solution, optionally, the third execution subunit includes:
[0123] The first execution module is used for, for each of the subproblems, if the subproblem is the first subproblem, detecting whether there is a solution of a historical subproblem consistent with the subproblem in the record table; if so, taking the solution of the historical subproblem as the solution of the subproblem, and determining the optimal path value of the subproblem according to the solution of the subproblem; if the subproblem is not the first subproblem, detecting whether there is a solution of a historical subproblem consistent with the subproblem in the record table; if so, taking the solution of the historical subproblem as the solution of the subproblem, and determining the optimal path value of the subproblem according to the solution of the subproblem and the optimal path value of the previous subproblem of the subproblem;
[0124] The second execution module is used to determine the path optimal value of the last sub-problem in each of the sub-problems as the path optimal solution of the shortest path problem.
[0125] In an embodiment provided by the present invention, based on the above solution, optionally, the recommendation unit 505 includes:
[0126] A sorting subunit, used to sort each of the target objects to be recommended in descending order of the recommendation score of each of the target objects to be recommended;
[0127] The recommendation subunit is used to recommend each of the target objects to be recommended based on the ranking of each of the target objects to be recommended.
[0128] The specific principles and execution processes of each unit and module in the graph computing-based recommendation device disclosed in the above embodiment of the present invention are the same as the graph computing-based recommendation method disclosed in the above embodiment of the present invention. Please refer to the corresponding parts of the graph computing-based recommendation method provided in the above embodiment of the present invention, and will not be repeated here.
[0129] An embodiment of the present invention further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned recommendation method based on graph calculation.
[0130] The embodiment of the present invention further provides an electronic device, the structural diagram of which is shown in FIG. Figure 6 As shown, it specifically includes a memory 601 and one or more instructions 602, wherein the one or more instructions 602 are stored in the memory 601 and are configured to be executed by one or more processors 603 to perform the following operations:
[0131] In response to the recommendation instruction, determining each object to be recommended;
[0132] Obtaining a pre-built knowledge graph for each of the objects to be recommended;
[0133] Determine whether the knowledge graph of each of the objects to be recommended meets the preset dynamic programming conditions;
[0134] For each of the objects to be recommended, if the knowledge graph of the object to be recommended meets the dynamic programming conditions, a preset dynamic programming algorithm is applied to perform graph calculation on the knowledge graph of the object to be recommended to obtain a recommendation score for the object to be recommended;
[0135] The objects to be recommended that have obtained the recommendation scores are determined as target objects to be recommended, and each of the target objects to be recommended is recommended according to the recommendation scores of each of the target objects to be recommended.
[0136] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0137] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0138] For the convenience of description, the above device is described as being divided into various units according to their functions. Of course, when implementing the present invention, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0139] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.
[0140] The above is a detailed introduction to a recommendation method based on graph computing provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A recommendation method based on graph computing, characterized in that: include: In response to the recommendation instruction, determining each object to be recommended; Obtaining a pre-built knowledge graph for each of the objects to be recommended; Determine whether the optimal solution to the shortest path problem of the knowledge graph of each object to be recommended satisfies the optimal substructure property, and whether there are overlapping subproblems in the subproblems of the shortest path problem of each knowledge graph of the object to be recommended; For each of the objects to be recommended, if the optimal solution of the shortest path problem of the knowledge graph of the object to be recommended satisfies the optimal substructure property, and there are overlapping subproblems in the subproblems of the shortest path problem of the knowledge graph of the object to be recommended, it is determined that the knowledge graph of the object to be recommended satisfies the preset dynamic programming conditions; otherwise, it is determined that the object to be recommended does not satisfy the dynamic programming conditions; For each of the objects to be recommended, when the knowledge graph of the object to be recommended meets the dynamic programming conditions, determining the sub-problems of the shortest path problem of the knowledge graph of the object to be recommended according to a preset dynamic programming algorithm, wherein the dynamic programming algorithm is a shortest path algorithm based on the Bellman equation; Obtain a record table corresponding to the knowledge graph; The record table is used to record the solutions of each sub-problem of the shortest path problem of each knowledge graph; Solve the sub-problems of the shortest path problem in sequence based on the record table to obtain an optimal solution to the shortest path problem; Obtaining a recommendation score for the object to be recommended based on the optimal solution of the path; The objects to be recommended that have obtained the recommendation scores are determined as target objects to be recommended, and each of the target objects to be recommended is recommended according to the recommendation scores of each of the target objects to be recommended.
2. The method according to claim 1, characterized in that The obtaining of a pre-built knowledge graph for each object to be recommended includes: Determining the object identification of each of the objects to be recommended; A pre-set graph database is queried based on the object identification of each object to be recommended to obtain a pre-built knowledge graph for each object to be recommended.
3. The method according to claim 1, characterized in that The step of solving the sub-problems of the shortest path problem in sequence based on the record table to obtain the optimal path solution of the shortest path problem includes: For each of the subproblems, if the subproblem is the first subproblem, check whether there is a solution to a historical subproblem that is consistent with the subproblem in the record table; if so, take the solution to the historical subproblem as the solution to the subproblem, and determine the optimal path value of the subproblem based on the solution to the subproblem; if the subproblem is not the first subproblem, check whether there is a solution to a historical subproblem that is consistent with the subproblem in the record table; if so, take the solution to the historical subproblem as the solution to the subproblem, and determine the optimal path value of the subproblem based on the solution to the subproblem and the optimal path value of the previous subproblem of the subproblem; The optimal path value of the last subproblem in each of the subproblems is determined as the optimal path solution of the shortest path problem.
4. The method according to claim 1, characterized in that: The recommending each of the target objects to be recommended according to the recommendation score of each of the target objects to be recommended includes: Sorting each of the target objects to be recommended in descending order of their recommendation scores; Recommend each of the target objects to be recommended based on the ranking of each of the target objects to be recommended.
5. A recommendation device based on graph computing, characterized in that: include: A determination unit, used to respond to the recommendation instruction and determine each object to be recommended; An acquisition unit, used to acquire a pre-built knowledge graph for each object to be recommended; A judgment unit, used to judge whether the knowledge graph of each object to be recommended meets a preset dynamic programming condition; a computing unit, configured to, for each of the objects to be recommended, apply a preset dynamic programming algorithm to perform graph computing on the knowledge graph of the object to be recommended, if the knowledge graph of the object to be recommended satisfies the dynamic programming condition, to obtain a recommendation score for the object to be recommended; A recommendation unit, configured to determine the recommended objects that have obtained the recommendation scores as target recommended objects, and to recommend each of the target recommended objects according to the recommendation scores of each of the target recommended objects; The judging unit comprises: A judgment subunit, used to judge whether the optimal solution of the shortest path problem of each of the knowledge graphs of the object to be recommended satisfies the optimal substructure property, and whether there are overlapping subproblems in the various subproblems of the shortest path problem of each of the knowledge graphs of the object to be recommended; The first execution subunit is used to determine, for each of the objects to be recommended, that the knowledge graph of the object to be recommended satisfies a preset dynamic programming condition when the optimal solution of the shortest path problem of the knowledge graph of the object to be recommended satisfies the optimal substructure property and there are overlapping subproblems in the subproblems of the shortest path problem of the knowledge graph of the object to be recommended; otherwise, determine that the object to be recommended does not satisfy the dynamic programming condition; The computing unit comprises: A second execution subunit is used to determine each sub-problem of the shortest path problem of the knowledge graph of the object to be recommended according to a preset dynamic programming algorithm, wherein the dynamic programming algorithm is a shortest path algorithm based on the Bellman equation; An acquisition subunit, used to acquire a record table corresponding to the knowledge graph; the record table is used to record the solutions of each sub-problem of the shortest path problem of each knowledge graph; A third execution subunit is used to solve the sub-problems of the shortest path problem in sequence based on the record table to obtain an optimal path solution for the shortest path problem; The fourth execution subunit is used to obtain a recommendation score for the object to be recommended based on the optimal path solution.
6. The device according to claim 5, characterized in that The acquisition unit comprises: A determination subunit, used to determine the object identifier of each object to be recommended; The query subunit is used to query a pre-set graph database based on the object identification of each object to be recommended, so as to obtain a pre-built knowledge graph of each object to be recommended.
7. A storage medium, characterized in that: The storage medium includes storage instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the graph computing-based recommendation method according to any one of claims 1 to 4.
8. An electronic device, characterized in that: The system comprises a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the graph computing-based recommendation method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Knowledge graph-based recommendation method and device, computer equipment and storage medium
CN111966912A
Object recommendation method and device based on path reasoning and electronic equipment
CN112884548A