Cloud api high-order complementary recommendation method and device, and medium
By constructing a cloud API relationship graph and designing logical operators to generate higher-order complementary probabilities, the diverse needs of cloud API recommendation in existing technologies are addressed, achieving efficient and accurate cloud API recommendation and mitigating the long-tail problem and the impact of substitute relationship noise.
Patent Information
- Application Number
- CN202510195718.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-02-21
AI Technical Summary
Existing technologies struggle to effectively recommend diverse and complementary cloud APIs that meet developers' business needs, resulting in low development efficiency and limited cloud API applications.
Construct a cloud API common call relationship graph, a function co-occurrence relationship graph, and a substitute relationship graph. Design projection, union, intersection, and negation logical operators to generate higher-order complementary probabilities and recommend cloud APIs that conform to strong and weak complementary relationships.
It enables efficient recommendations of diverse cloud APIs that meet developers' needs, alleviates the long-tail problem, eliminates the influence of noise from substitute relationships, and improves the accuracy and efficiency of recommendation results.
Smart Images

Figure CN120122928B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent software engineering, and more particularly, to a cloud API high-order complementary recommendation method and device and medium. BACKGROUND
[0002] In the current practice of software engineering, service-oriented architecture has become a widely used software development paradigm, and the application program developed by using the loosely coupled architecture has better flexibility and scalability. With the wide practice and in-depth development of the concept of service-oriented software development, cloud API has become an indispensable core element in the current development and operation of SOA software system as the best carrier for data exchange, function reuse and service delivery. Therefore, more and more enterprises and organizations have used cloud API technology to service and monetize their core businesses, AI algorithms and data assets, thus promoting the rapid growth of the number and types of cloud APIs in the network. In the face of the massive and continuously growing cloud APIs, developers often have difficulty in comprehensively understanding and quickly selecting cloud APIs that meet current business needs, and repeated searches for cloud APIs not only greatly affect the enthusiasm of developers and the development efficiency of software, but also limit the wide application of cloud APIs and the healthy development of API economy. Therefore, how to accurately and efficiently recommend cloud APIs that meet the business needs of developers has become a real problem that needs to be solved in service-oriented software development.
[0003] In recent years, in view of the problem of cloud API overload, researchers have proposed various cloud API recommendation methods from different perspectives. Typical methods include content understanding driven, service quality perception based, and preference prediction based cloud API recommendation. The content understanding driven cloud API recommendation method takes the user's explicit business function demand as input, and quickly recommends and retrieves the cloud API related to the content through keyword matching or semantic understanding. The service quality perception based cloud API recommendation method takes the perspective of non-functional side of cloud API, and uses service quality as a constraint to generate high-quality cloud API recommendation results. The preference prediction based cloud API recommendation method focuses on the historical interaction relationship between the user and the cloud API, and tries to achieve personalized cloud API recommendation by predicting the user's calling preference. Although existing research has carried out a lot of research around the conditions of retrieval content, service quality and user preference, and these have played a positive role in solving the problem of cloud API overload, but this cannot meet the objective needs of developers for diversified complementary cloud API recommendation in the process of SOA software development. SUMMARY
[0004] To solve the above technical problems, the application provides a cloud API high-order complementary recommendation method, device and medium to solve the limitations and challenges faced by the current intelligent software engineering field in cloud API recommendation, effectively taking into account the strong and weak complementary relationship between the cloud API query set and the candidate cloud API and eliminating the influence of the complementary relationship, and meeting the needs of developers for high-order complementary cloud API.
[0005] In the first aspect, the application provides a cloud API high-order complementary recommendation method, which comprises:
[0006] According to the application call cloud API history record and the cloud API function label, a cloud API common call relationship graph CIG, a cloud API function co-occurrence relationship graph FCG and a cloud API complementary relationship graph SRG are generated;
[0007] Four kinds of logical operators are designed;
[0008] The embedding vector of the query cloud API is generated;
[0009] The cloud API common call relationship graph CIG and the logical operator are used to generate the probability that each candidate cloud API has a strong complementary relationship with the query set Q;
[0010] The cloud API function co-occurrence relationship graph FCG and the logical operator are used to generate the probability that each candidate cloud API has a weak complementary relationship with the query set Q;
[0011] The cloud API complementary relationship graph SRG and the logical operator are used to generate the probability that each candidate cloud API does not have a complementary relationship with the query set Q;
[0012] The high-order complementary probability which takes into account the strong and weak complementary relationship and eliminates the influence of the complementary relationship is obtained by using the AND and OR logical operators;
[0013] The candidate cloud API is sorted according to the high-order complementary probability from large to small to obtain a high-order complementary cloud API recommendation list.
[0014] Further, according to the application call cloud API history record and the cloud API function label, a cloud API common call relationship graph CIG, a cloud API function co-occurrence relationship graph FCG and a cloud API complementary relationship graph SRG are generated, which comprises:
[0015] The cloud API common call relationship graph CIG is constructed:
[0016] CIG=(A,E CI ,ε CI )
[0017] Wherein A={a1,a2,L a n} denotes a cloud API node, a1, a2, L an denotes the first, second, and n-th cloud API node; E CI = {0, 1} denotes the set of common invocation relations between nodes, 1 denotes that there is an edge between cloud API nodes depicting common invocation relations, and 0 denotes that there is no edge between cloud API nodes depicting common invocation relations; ε CI denotes the first conversion function, which is a mapping from A x A to E CI , used to depict the common invocation relations between cloud APIs and cloud APIs;
[0018] Construct a cloud API function co-occurrence relation graph FCG:
[0019] FCG = (A, E FC , ε FC )
[0020] where E FC = {0, 1} denotes the set of function co-occurrence relations between nodes, 1 denotes that there is an edge between cloud API nodes depicting function co-occurrence relations, and 0 denotes that there is no edge between cloud API nodes depicting function co-occurrence relations; ε FC denotes the second conversion function, which is a mapping from A x A to E FC , used to depict the function co-occurrence relations between cloud APIs and cloud APIs;
[0021] Construct a cloud API substitute relation graph SRG:
[0022] SRG = (A, E SR , ε SR )
[0023] where E SR = {0, 1} denotes the set of substitute relations between nodes, 1 denotes that there is an edge between cloud API nodes depicting substitute relations, and 0 denotes that there is no edge between cloud API nodes depicting substitute relations; ε SR denotes the second conversion function, which is a mapping from A x A to E SR , used to depict the substitute relations between cloud APIs and cloud APIs.
[0024] Further, four kinds of logical operators are designed, including:
[0025] Design a projection operator P r under the relation constraint r:
[0026] P r (E(a q )) = [p r (E(a1)|E(a q )), …, p r (E(a i )|E(aq )),…,p r (E(a n )|E(a q ))
[0027] where P r (E(a q )) is the probability of a r (E(a1)|E(a q )) being linked to candidate cloud API a1 through relation r; p q (E(a r )|E(a i )) is the probability of a q (E(a q )|E(a i )) being linked to candidate cloud API a r through relation r; p n (E(a q )|E(a q )) is the probability of a n (E(a i )|E(a i )) being linked to candidate cloud API a q through relation r; E(a1) is the embedding vector of candidate cloud API a1; E(a q ) is the embedding vector of candidate cloud API a
[0028] Design and operator U:
[0029]
[0030] where P is the probability of a candidate cloud API having relation r1 with or having relation r2 with ; P is the probability of being linked to all candidate cloud APIs through relation r1; P is the probability of being linked to all candidate cloud APIs through relation r2; E(q1) is the embedding vector of query cloud API q1; E(q2) is the embedding vector of query cloud API q2;
[0031] Design intersection operator I:
[0032]
[0033] where P is the probability of a candidate cloud API having relation r1 with having relationship r1 and having relationship r2; the probability of having relationship r2;
[0034] Design negation operator N:
[0035] N(P r (E(a q ))) = 1 - P r (E(a q ))
[0036] where N(P r (E(a q ))) is the probability of candidate cloud API not having relationship r with a q ; P r (E(a q )) is the link probability of a q with all candidate cloud APIs through relationship r.
[0037] Further, the embedding vector of the query cloud API is generated by the following formula:
[0038]
[0039] where EU is the embedding unit, is the embedding vector of the query cloud API.
[0040] Further, the probability of each candidate cloud API having a strong complementary relationship with the query set Q is generated by using the cloud API common invocation relationship graph CIG and logical operators, including:
[0041] Project the cloud APIs in the query set using the common invocation relationship to obtain the probability of each candidate cloud API having a strong complementary relationship with each cloud API in Q wherein is one query cloud API in the query set Q; is the probability of the candidate cloud API having a strong complementary relationship with the query cloud API ; and
[0042] After the intersection operator operation on , the probability of the candidate cloud API having a strong complementary relationship with the whole Q is obtained
[0043] Further, the probability of each candidate cloud API having a weak complementary relationship with the query set Q is generated by using the cloud API function co-occurrence relationship graph FCG and logical operators, including:
[0044] Project the cloud APIs in the query set The cloud APIs in Q are projected using the co-occurrence relationships of their functions to obtain the probability that a candidate cloud API has a weak complementary relationship with each cloud API in Q. in, Candidate Cloud API and Query Cloud API The probability of having a weak complementary relationship;
[0045] Will After crossover operator operations, the probability that the candidate cloud API and Q as a whole have a weak complementary relationship is obtained.
[0046] Furthermore, using the cloud API substitute relationship graph SRG and logical operators, the probability that each candidate cloud API does not have a substitute relationship with the query set Q is generated, including:
[0047] query set The cloud APIs in Q are projected using substitution relationships to obtain the probability that a candidate cloud API has a substitution relationship with each cloud API in Q. in, Candidate Cloud API and Query Cloud API The probability that they do not have a complementary relationship;
[0048] Will After performing the union operator operation, the probability that the candidate cloud API has a substitute relationship with one or more cloud APIs in Q is obtained.
[0049]
[0050] For P SR (Q) Perform the negation operator operation to obtain the probability P that the candidate cloud API has no substitute relationship with any of the cloud APIs in Q. NS (Q)=1-P SR (Q).
[0051] Furthermore, by utilizing union and intersection logic operators, higher-order complementarity probabilities are obtained that take into account both strong and weak complementarity relationships and eliminate the influence of substitute relationships, including:
[0052] The probability P that the candidate cloud API has a strong complementary relationship with Q as a whole. CI (Q) and the probability P that has a weak complementary relationship with Q. FC (Q), after the union operator operation, yields the probability P that has a strong or weak complementary relationship with Q. CI∪FC (Q):
[0053] P CI∪FC (Q)=U(P CI (Q),P FC (Q))
[0054] The probability P that the candidate cloud API has no alternative relationship with the Q as a whole NS (Q) and P CI∪FC (Q) is subjected to intersection operator operation to obtain a high-order complementary probability P that the Q as a whole has a strong complementary relationship or a weak complementary relationship but has no alternative relationship (CI∪FC)∩NS (Q):
[0055] P (CI∪FC)∩NS (Q) = I(P CI∪FC (Q), P NS (Q)) = I(U(P CI (Q), P FC (Q)), P NS (Q))
[0056] In a second aspect, the present application provides a cloud API high-order complementary recommendation device, the device comprising:
[0057] A relationship graph generation unit configured to generate a cloud API common calling relationship graph CIG, a cloud API function co-occurrence relationship graph FCG, and a cloud API alternative relationship graph SRG according to application calling cloud API history records and cloud API function tags;
[0058] A logical operator design unit configured to design four kinds of logical operators;
[0059] An embedding vector generation unit configured to generate an embedding vector of a query cloud API;
[0060] A first probability calculation unit configured to generate a probability that each candidate cloud API has a strong complementary relationship with a query set Q by using the cloud API common calling relationship graph CIG and the logical operator;
[0061] A second probability calculation unit configured to generate a probability that each candidate cloud API has a weak complementary relationship with the query set Q by using the cloud API function co-occurrence relationship graph FCG and the logical operator;
[0062] A third probability calculation unit configured to generate a probability that each candidate cloud API has no alternative relationship with the query set Q by using the cloud API alternative relationship graph SRG and the logical operator;
[0063] A fourth probability calculation unit configured to obtain a high-order complementary probability by taking into account the strong and weak complementary relationships and eliminating the influence of the alternative relationship by using the AND and intersection logical operators;
[0064] A recommendation list generation unit configured to sort the candidate cloud APIs in descending order of the high-order complementary probability to obtain a high-order complementary cloud API recommendation list.
[0065] In a third aspect, the present application provides a readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method described above.
[0066] The present application has at least the following beneficial effects:
[0067] 1. The present application provides a multi-view cloud API complementary relationship modeling scheme. A cloud API common calling relationship graph, a cloud API function co-occurrence relationship graph and a cloud API substitution relationship graph are constructed to model the complementary relationship.
[0068] 2. The present application establishes a weak complementary relationship logical inference network guided by a cloud API function co-occurrence relationship graph. It can enhance the performance of the recommendation result while alleviating the long tail problem that is difficult to avoid in complementary cloud API recommendation.
[0069] 3. The present application establishes a non-substitution logical inference network combining a cloud API substitution relationship graph and a negation operator. It can eliminate the influence of substitution relationship noise on the complementary recommendation result.
[0070] 4. The present application provides a high-order complementary cloud API recommendation method based on logical inference. The results of strong complementary relationship logical inference, weak complementary relationship logical inference and non-substitution logical inference are integrated by using projection, intersection, union and negation logical operators to meet the requirement of high-order complementary recommendation. BRIEF DESCRIPTION OF DRAWINGS
[0071] Figure 1 The overall flowchart of a cloud API high-order complementary recommendation method according to an embodiment of the present application is shown.
[0072] Figure 2 The schematic diagram of a cloud API high-order complementary recommendation method according to an embodiment of the present application is shown.
[0073] Figure 3 The structure diagram of a cloud API high-order complementary recommendation device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0074] To enable those skilled in the art to better understand the technical solutions of the present application, the present application is described in detail below in combination with the drawings and specific embodiments. The embodiments of the present application are further described in detail below in combination with the drawings and specific embodiments, but are not limited to the present application. The order in which each step is described herein as an example should not be considered as a limitation, and those skilled in the art should know that the order can be adjusted, as long as the logical relationship between them is not destroyed and the whole process can be realized.
[0075] The embodiment of the application provides a cloud API high-order complementary recommendation method, which comprises the following steps S1-S8. Figure 1 The cloud API high-order complementary recommendation method comprises the following steps S1-S8.
[0076] S1, according to application calling cloud API history records and cloud API function tags, generating cloud API common calling relationship graph CIG, cloud API function co-occurrence relationship graph FCG and cloud API substitution relationship graph SRG.
[0077] In some embodiments, step S1 specifically comprises the following steps S1.1-S1.4.
[0078] S1.1, according to application calling cloud API history records and cloud API function tags, respectively constructing an application set M, a cloud API set A and a tag set T, wherein m∈M represents an application in the application set, a∈A represents a cloud API in the cloud API set, and t∈T represents a tag in the tag set.
[0079] S1.2, constructing a cloud API-cloud API common calling relationship graph CIG:
[0080] CIG=(A,E CI ,ε CI )
[0081] Wherein A={a1,a2,L a n} represents a cloud API node; E CI ={0,1} represents a common calling relationship set between nodes, 1 represents that there is an edge between cloud API nodes depicting a common calling relationship, and 0 represents that there is no edge between cloud API nodes depicting a common calling relationship; the conversion function ε CI is a mapping from A×A to E CI , and is used to depict the common calling relationship between cloud APIs and cloud APIs.
[0082] The specific implementation is as follows:
[0083] Traverse different cloud API pairs (a i , a j ) in the cloud API set A, judge whether a i and a j have ever been called by the same application m∈M based on the historical calling behavior of the application and the cloud API, that is, whether there is a common calling relationship. If there is a common calling behavior between ai and aj, that is, ε CI (a i ,a j )=1, then there is an edge between ai and aj in CIG, and the weight is 1, otherwise ε CI (ai a j ) = 0.
[0084] S1.3, constructing a cloud API-cloud API function co-occurrence graph FCG:
[0085] FCG = (A, E FC , ε FC )
[0086] where A = {a1, a2, L a n} represents cloud API nodes; E FC = {0, 1} represents a set of function co-occurrence relationships between nodes, 1 represents that there is an edge between cloud API nodes depicting function co-occurrence relationship, and 0 represents that there is no edge between cloud API nodes depicting function co-occurrence relationship; the conversion function ε FC is a mapping from A x A to E FC , used to depict the function co-occurrence relationship between cloud APIs and cloud APIs.
[0087] The specific implementation is as follows:
[0088] Traverse different cloud API pairs (a i , a j ) in the cloud API set A, and based on the function tag set T, determine whether there is an application simultaneously calling cloud API a p with f i function and cloud API a q with f j function, that is, whether there is a function co-occurrence relationship between a i and a j . If there is a function co-occurrence between a i and a j , that is, ε FC (a i , a j ) = 0, then there is an edge between ai and aj in FCG, and the weight is 1, otherwise ε FC (a i , a j ) = 0.
[0089] S1.4, constructing a cloud API-cloud API substitute relationship graph SRG:
[0090] SRG = (A, E SR , ε SR )
[0091] where A = {a1, a2, L a n} represents cloud API nodes; E SR= {0,1} represents the set of substitute relationships between nodes, where 1 indicates that there are edges describing substitute relationships between cloud API nodes, and 0 indicates that there are no edges describing substitute relationships between cloud API nodes; the transformation function ε SR For A×A→E SR The mapping is used to characterize the substitute relationship between cloud APIs.
[0092] The specific implementation is as follows:
[0093] Traverse different cloud API pairs (a) in cloud API set A i a j Based on the set of function tags T, determine whether any application has simultaneously called a function with tag f. p Cloud API with functionalities i and f q Cloud API with functionalities j That is, a i With a j Does a functional co-occurrence relationship exist between them? If a i and a j There is functional co-occurrence, i.e., ε FC (a i ,a j If ε = 0, then there is an edge between ai and aj in the SRG with a weight of 1; otherwise, ε = 0. FC (a i ,a j ) = 0.
[0094] S2. Design four logical operators.
[0095] In some embodiments, step S2 specifically includes steps S2.1 to S2.4.
[0096] S2.1 Design the projection operator P under relational constraint r. r :
[0097] P r (E(a q ))=[p r (E(a1)|E(a q )),…,p r (E(a i )|E(a q )),…,p r (E(a n )|E(a q ))]
[0098] Where P r (E(a q) ) is a qThe link probability of a candidate cloud API through a relation r. The relation constraints r include the co-call constraint CI, the functional co-occurrence constraint FC, and the substitute constraint SR.
[0099] The implementation is as follows:
[0100] For a given cloud API a q and a relation r, the projection operator needs to model the link probability P i (a r |a i |a q ) of a candidate cloud API a i The node representation of a cloud API a q in the cloud API relation graph G is initialized as:
[0101]
[0102] where E(q) and E(r) are the embedding representations of a q and relation r, respectively.
[0103] The cloud API relation graph G = {CI G, FC G, SR G} is iterated T times to obtain the node representation of G with aggregated neighbor information. The node representation of G after iterating and aggregating neighbor information T times is denoted as: The representation of a candidate cloud API a r is fed into a multi-layer perception (MLP) and passes through a Sigmoid activation function to obtain the probability of linking with a candidate cloud API a q under a relation r:
[0104]
[0105] S2.2, design and operator U:
[0106]
[0107] S2.3, design intersection operator I:
[0108]
[0109] S2.4, design negation operator N:
[0110] N(P r (E(a q ))) = 1 - P q (E(a r ))
[0111] S3, generate the embedding vector of the query cloud API.
[0112] In some embodiments, one-hot encoding is used to generate the embedding vector of the query cloud API, and the calculation formula is:
[0113]
[0114] S4. Using the Common Invocation Relationship Graph (CIG) and logical operators, generate the probability that each candidate cloud API has a strong complementary relationship with the query set Q.
[0115] In some embodiments, step S4 specifically includes the following steps S4.1 and S4.2.
[0116] S4.1, Query set The cloud APIs in Q are projected using common calling relationships to obtain the probability that the candidate cloud API has a strong complementary relationship with each cloud API in Q.
[0117]
[0118] S4.2, will After performing intersection operator operations, the probability that the candidate cloud API and Q as a whole have a strong complementary relationship is obtained.
[0119] S5. Using the functional co-occurrence graph (FCG) and logical operators, generate the probability that each candidate cloud API has a weak complementary relationship with the query set Q.
[0120] In some embodiments, step S5 specifically includes the following steps S5.1 and S5.2.
[0121] S5.1, Query set The cloud APIs in Q are projected using the co-occurrence relationships of their functions to obtain the probability that a candidate cloud API has a weak complementary relationship with each cloud API in Q.
[0122]
[0123] S5.2, will After crossover operator operations, the probability that the candidate cloud API and Q as a whole have a weak complementary relationship is obtained.
[0124] S6. Using the substitute relationship graph SRG and logical operators, generate the probability that each candidate cloud API does not have a substitute relationship with the query set Q.
[0125] In some embodiments, step S6 specifically includes the following steps S6.1 to S6.3.
[0126] S6.1, Query set The cloud APIs in Q are projected using substitution relationships to obtain the probability that a candidate cloud API has a substitution relationship with each cloud API in Q.
[0127]
[0128] S6.2, the After the operator operation, the probability that the candidate cloud API has a complementary relationship with one or more cloud APIs in Q is obtained
[0129]
[0130] S6.3, P SR (Q) is obtained by performing the NOT operator operation on P NS (Q) = 1-P SR (Q).
[0131] S7, using AND and INTER logic operators, a high-order complementary probability is obtained, which takes into account strong and weak complementary relationships and eliminates the influence of complementary relationships.
[0132] In some embodiments, step S6 specifically includes steps S7.1 to S7.2.
[0133] S7.1, the probability P CI (Q) that the candidate cloud API has a strong complementary relationship with Q as a whole and the probability P FC (Q) that it has a weak complementary relationship with Q, are subjected to AND operator operation to obtain the probability P CI∪FC (Q) that it has a strong complementary relationship or a weak complementary relationship with Q:
[0134] P CI∪FC (Q) = U(P CI (Q), P FC (Q))
[0135] S7.2, the probability P NS (Q) that the candidate cloud API has no complementary relationship with Q as a whole and P CI∪FC (Q) are subjected to INTER operator operation to obtain the high-order complementary probability P (CI∪FC)∩NS (Q) that it has a strong complementary relationship or a weak complementary relationship with Q as a whole but has no complementary relationship:
[0136] P (CI∪FC)∩NS (Q) = I(P CI∪FC (Q), P NS (Q)) = I(U(P CI (Q), P FC (Q)), P NS (Q))
[0137] S8, according to the high-order complementary probability, the candidate cloud API is sorted from large to small to obtain a high-order complementary cloud API recommendation list.
[0138] In some embodiments, the high-order complementary cloud API recommendation list is calculated by sorting the candidate cloud API from large to small according to the high-order complementary probability.
[0139]
[0140] The model parameters are updated by minimizing binary cross-entropy during the training process.
[0141]
[0142] where Q is a query set, A Q is a complementary item set having a complementary relationship with Q, is a non-complementary item set not having a complementary relationship with Q, and P(a|Q) is a complementary probability of the LRN4HCAR predicting that the candidate cloud API a has a complementary relationship with the query set Q. By maximizing the complementary probability of the complementary item with Q and minimizing the complementary probability of the non-complementary item with Q, the model can achieve better learning results.
[0143] In the above embodiment, the embodiment of the present application provides a cloud API high-order complementary recommendation method based on logical operators. The present application is different from the existing cloud API recommendation method. The present application proposes a multi-perspective cloud API complementary relationship modeling method. A cloud API common calling relationship graph, a cloud API function co-occurrence relationship graph, and a cloud API substitution relationship graph are constructed to model the complementary relationship. Meanwhile, the present application establishes a weak complementary relationship logical reasoning network guided by a cloud API function co-occurrence relationship graph. The weak complementary relationship logical reasoning network can not only enhance the recommendation result performance by using the weak complementary relationship, but also alleviate the long tail problem that cannot be avoided in complementary cloud API recommendation. Meanwhile, the present application establishes a non-substitution logical reasoning network combining a cloud API substitution relationship graph and a NOT operator. The non-substitution logical reasoning network can eliminate the influence of substitution relationship noise on the complementary recommendation result. Meanwhile, the present application proposes a cloud API high-order complementary recommendation method based on logical operators. The cloud API high-order complementary recommendation method uses projection, intersection, union, and NOT logical operators to comprehensively use the results of strong complementary relationship logical reasoning, weak complementary relationship logical reasoning, and non-substitution logical reasoning, so as to meet the requirement of high-order complementary recommendation.
[0144] The embodiment of the present application also provides a cloud API high-order complementary recommendation device, as shown in FIG. 3, the device comprises: Figure 3
[0145] A relationship graph generation unit 301 is configured to generate a cloud API common calling relationship graph CIG, a cloud API function co-occurrence relationship graph FCG, and a cloud API substitution relationship graph SRG according to application calling cloud API historical records and cloud API function tags;
[0146] A logical operator design unit 302 is configured to design four kinds of logical operators;
[0147] An embedding vector generation unit 303 is configured to generate an embedding vector of a query cloud API;
[0148] The first probability calculation unit 304 is configured to generate a probability that each candidate cloud API has a strong complementary relationship with the query set Q by using the cloud API co-call relationship graph CIG and a logical operator;
[0149] The second probability calculation unit 305 is configured to generate a probability that each candidate cloud API has a weak complementary relationship with the query set Q by using the cloud API function co-occurrence relationship graph FCG and a logical operator;
[0150] The third probability calculation unit 306 is configured to generate a probability that each candidate cloud API has no substitution relationship with the query set Q by using the cloud API substitution relationship graph SRG and a logical operator;
[0151] The fourth probability calculation unit 307 is configured to obtain a high-order complementary probability by taking into account the strong and weak complementary relationships and eliminating the influence of the substitution relationship by using AND and OR logical operators.
[0152] The recommendation list generation unit 308 is configured to sort the candidate cloud APIs according to the high-order complementary probability from large to small to obtain a high-order complementary cloud API recommendation list.
[0153] It should be noted that the structures of the various cloud API high-order complementary recommendation devices described in the embodiments belong to the same technical concept as the cloud API high-order complementary recommendation method described above, and achieve the same beneficial effects through the same principles, which will not be described here.
[0154] The embodiment of the application further provides a readable storage medium, the readable storage medium stores one or more programs, the one or more programs can be executed by one or more processors to implement the method described in any of the above embodiments.
[0155] The above description is intended to be illustrative and not restrictive. For example, the above examples (or one or more aspects thereof) can be used in combination with each other. Other embodiments can be used as would be apparent to one of ordinary skill in the art upon reading the above description. Additionally, in the above detailed description, various features can be grouped together in one or more embodiments for simplicity. This should not be interpreted as a requirement that the features be grouped together in one or more embodiments. Rather, the subject matter has broader scope associated with the claims below, and changes can be made to the embodiments in various respects, s o long as the changes come within the scope of the claims below and their equivalents. The scope of the application should be determined with reference to the following claims, and the full scope of equivalents to which such claims are entitled.
Claims
1. A cloud API high-order complementary recommendation method, characterized in that, The method comprises: According to the application call cloud API history record and the cloud API function label, a cloud API common call relationship graph CIG, a cloud API function co-occurrence relationship graph FCG and a cloud API substitute relationship graph SRG are generated; Four kinds of logical operators are designed; An embedding vector of a query cloud API is generated; The cloud API common call relationship graph CIG and the logical operators are used to generate a probability that each candidate cloud API has a strong complementary relationship with the query set Q; The cloud API function co-occurrence relationship graph FCG and the logical operators are used to generate a probability that each candidate cloud API has a weak complementary relationship with the query set Q; The cloud API substitute relationship graph SRG and the logical operators are used to generate a probability that each candidate cloud API does not have a substitute relationship with the query set Q; The AND and OR logical operators are used to obtain a high-order complementary probability which takes into account the strong and weak complementary relationships and eliminates the influence of the substitute relationship; The candidate cloud APIs are sorted according to the high-order complementary probability from large to small to obtain a high-order complementary cloud API recommendation list; The cloud API common call relationship graph CIG and the logical operators are used to generate a probability that each candidate cloud API has a strong complementary relationship with the query set Q, comprising: query set The cloud APIs in Q are projected using common calling relationships to obtain the probability that the candidate cloud API has a strong complementary relationship with each cloud API in Q. in, It is a query cloud API in query set Q; Candidate Cloud API and Query Cloud API The probability of having a strong complementary relationship; The After the intersection operator operation, the probability that the candidate cloud API and Q as a whole have a strong complementary relationship is obtained The cloud API function co-occurrence relationship graph FCG and the logical operators are used to generate a probability that each candidate cloud API has a weak complementary relationship with the query set Q, comprising: query set The cloud APIs in Q are projected using the co-occurrence relationships of their functions to obtain the probability that a candidate cloud API has a weak complementary relationship with each cloud API in Q. in, Candidate Cloud API and Query Cloud API The probability of having a weak complementary relationship; The After the intersection operator operation, the probability that the candidate cloud API and Q as a whole have a weak complementary relationship is obtained The cloud API substitute relationship graph SRG and the logical operators are used to generate a probability that each candidate cloud API does not have a substitute relationship with the query set Q, comprising: The query set is projected with the substitute relationship to obtain a probability that each cloud API in Q has a substitute relationship with the candidate cloud API wherein, is a probability that the candidate cloud API and the query cloud API do not have a complementary relationship. After the operator operation, the probability that the candidate cloud API has a substitute relationship with one or more cloud APIs in Q is obtained P SR (Q) is obtained by performing an exclusive OR operator operation on P NS (Q) = 1 - P SR (Q) The AND and OR logical operators are used to obtain a high-order complementary probability which takes into account the strong and weak complementary relationships and eliminates the influence of the substitute relationship, comprising: P is the probability that the candidate cloud API has a strong complementary relationship with the Q as a whole CI P is the probability that the candidate cloud API has a weak complementary relationship with the Q FC P is the probability that the candidate cloud API has a strong complementary relationship with the Q as a whole CI∪FC P is the probability that the candidate cloud API has a strong complementary relationship with the Q as a whole P CI∪FC (Q) = U(P CI (Q), P FC (Q)) The probability P that the candidate cloud API has no alternative relationship with the Q as a whole NS (Q) and P CI∪FC (Q) is subjected to an intersection operator operation to obtain a high-order complementary probability P that has a strong complementary relationship or a weak complementary relationship but no alternative relationship with Q as a whole (CI∪FC)∩NS (Q): P (CI∪FC)∩NS (Q) = I(P CI∪FC (Q), P NS (Q)) = I(U(P CI (Q), P FC (Q)), P NS (Q)). 2.The cloud API high-order complementary recommendation method according to claim 1, characterized in that, According to the application call cloud API history record and the cloud API function label, a cloud API common call relationship graph CIG, a cloud API function co-occurrence relationship graph FCG and a cloud API substitute relationship graph SRG are generated, comprising: A cloud API common call relationship graph CIG is constructed: CIG = (A, E CI , ε CI ) where A = {a1, a2, … a n} denotes the set of cloud API nodes, a1, a2, … a n denote the first, second, and nth cloud API nodes; E CI = {0, 1} denotes the set of common invocation relations between nodes, 1 indicates that there is an edge between the cloud API nodes depicting the common invocation relation, and 0 indicates that there is no edge between the cloud API nodes depicting the common invocation relation; ε CI denotes the first conversion function, which is a mapping from A x A to E CI , used to depict the common invocation relation between cloud APIs and cloud APIs; A cloud API function co-occurrence relationship graph FCG is constructed: FCG = (A, E FC , ε FC ) wherein E FC ={0,1} represents a set of functional co-occurrence relations between nodes, 1 represents that there is an edge between cloud API nodes depicting a functional co-occurrence relation, and 0 represents that there is no edge between cloud API nodes depicting a functional co-occurrence relation; ε FC represents a second conversion function, which is a mapping from A x A to E FC , and is used to depict the functional co-occurrence relation between cloud APIs and cloud APIs; A cloud API substitute relationship graph SRG is constructed: SRG = (A, E SR , ε SR ) where E SR = {0,1} represents the set of substitution relations between nodes, 1 indicates that there is an edge between cloud API nodes depicting the substitution relation, and 0 indicates that there is no edge between cloud API nodes depicting the substitution relation; ε SR represents a second conversion function, which is a mapping from A x A to E SR , used to depict the substitution relation between cloud APIs and cloud APIs. 3.The cloud API high-order complementary recommendation method according to claim 1, characterized in that, Four kinds of logical operators are designed, comprising: Designing a projection operator P under relational constraint r r : P r (E(a q ))=[p r (E(a1)|E(a q )),…,p r (E(a i )|E(a q )),…,p r (E(a n )|E(a q ))] where P r (E(a q )) is a q probability of linking to candidate cloud API a r through relation r; p q (E(a1)|E(a q )) is a r probability of linking to candidate cloud API a1 i through relation r; p q (E(a q )|E(a i )) is a r probability of linking to candidate cloud API a n through relation r; p q (E(a q )|E(a n )) is a i probability of linking to candidate cloud API a i through relation r; E(a1) is an embedding vector of candidate cloud API a1; E(a q ) is an embedding vector of candidate cloud API a q ; An AND operator U is designed: wherein is the probability that a candidate cloud API has relationship r1 or is related to ; has relationship r2; is the probability that a candidate cloud API is related to ; is the probability that a candidate cloud API is related to ; is the embedding vector of the query cloud API ; is the embedding vector of the query cloud API ; An OR operator I is designed: wherein is the probability that a candidate cloud API has a relationship r1 with and a relationship r2 with the probability that a candidate cloud API has a relationship r1 with A NOT operator N is designed: N(P r (E(a q ))) = 1 - P r (E(a q )) Where N(P) r (E(a q The candidate cloud API is not related to a. q The probability of having relation r; P r (E(a q )) is a q The probability of linking relation r with all candidate cloud APIs. 4.The cloud API high-order complementary recommendation method of claim 1, wherein, An embedding vector of a query cloud API is generated by the following formula: wherein EU is an embedding unit, to query the cloud API embedding vector.
5. A cloud API high-order complementary recommendation apparatus based on the method of any one of claims 1 to 4, characterized in that, The device comprises: A relationship graph generation unit configured to generate, according to an application call cloud API history record and a cloud API function label, a cloud API common call relationship graph CIG, a cloud API function co-occurrence relationship graph FCG and a cloud API substitute relationship graph SRG; A logical operator design unit configured to design four kinds of logical operators; An embedding vector generation unit configured to generate an embedding vector of a query cloud API; A first probability calculation unit configured to use the cloud API common call relationship graph CIG and the logical operators to generate a probability that each candidate cloud API has a strong complementary relationship with the query set Q; A second probability calculation unit configured to use the cloud API function co-occurrence relationship graph FCG and the logical operators to generate a probability that each candidate cloud API has a weak complementary relationship with the query set Q; a third probability calculation unit configured to generate a probability that each candidate cloud API does not have a substitution relationship with the query set Q by using the cloud API, the substitution relationship graph SRG, and the logical operator; a fourth probability calculation unit configured to obtain a high-order complementary probability by taking into account strong and weak complementary relationships and eliminating the influence of the substitution relationship by using AND and OR logical operators; a recommendation list generation unit configured to sort the candidate cloud APIs according to the high-order complementary probability from large to small to obtain a high-order complementary cloud API recommendation list.
6. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, perform the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
High-order complementary cloud API recommendation method based on logical reasoning
CN118277667A