Cloud API high-order complementary recommendation method and device and medium
By building a cloud API relationship diagram and designing logical operators, high-order complementary probability between candidate cloud API and query set is solved, and the problem of developers finding high-order complementary cloud APIs that meet business needs is solved, and efficient cloud API recommendations are achieved.
Patent Information
- Application Number
- CN202510195718.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-02-21
AI Technical Summary
In the process of SOA software development, it is difficult for developers to quickly find high-level complementary cloud APIs that meet business needs. The existing recommended methods cannot effectively take into account the strength and weakness complementary relationships and substitute relationships between cloud APIs.
By constructing a cloud API co-call relationship diagram, a function co-occurrence relationship diagram and a substitute relationship diagram, and design projection, union, interchange and inverse logic operators, generate high-order complementarity probability between the candidate cloud API and the query set, integrate the strong and weak complementarity relationship and eliminate the impact of the substitute relationship.
It realizes efficient recommendations for diversified complementary cloud APIs, meets developers' needs for advanced complementary cloud APIs, and improves the efficiency of cloud API query and selection.
Smart Images

Figure CN120122928A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent software engineering, and more specifically, to a high-order complementary recommendation method, device and medium for cloud APIs. Background Art
[0002] In current software engineering practices, the service-oriented architecture has become a widely adopted software development paradigm. Applications developed using a loosely coupled architecture approach have better flexibility and scalability. With the wide practice and in-depth development of the service-oriented software development concept, cloud APIs, as the best carrier for data exchange, function reuse, and service delivery, have become an indispensable core element in the development and operation of current SOA software systems. Therefore, more and more enterprises and organizations have been using cloud API technology to serviceize and monetize their core businesses, AI algorithms, and data assets, which has promoted the rapid growth of the types and numbers of cloud APIs in the network. Facing the massive and continuously growing cloud APIs, developers often find it difficult to comprehensively understand and quickly select cloud APIs that meet the current business requirements. Moreover, the repeated search for cloud APIs not only greatly affects the enthusiasm of developers and the software development efficiency but also restricts the wide application of cloud APIs and the healthy development of the API economy. Therefore, how to accurately and efficiently recommend cloud APIs that meet the business needs of developers has become a realistic problem that urgently needs to be solved in service-oriented software development.
[0003] In recent years, in response to the cloud API overload problem, researchers have proposed various cloud API recommendation methods from different perspectives. Typical methods include content understanding-driven, service quality-aware, and preference prediction-based cloud API recommendations. The content understanding-driven cloud API recommendation method takes the clear business function requirements of users as input and quickly recommends cloud APIs related to the retrieved content through keyword matching or semantic understanding. The service quality-aware cloud API recommendation method, from the perspective of the non-functional side of cloud APIs, 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 users and cloud APIs and attempts to achieve personalized cloud API recommendations by predicting users' call preferences. Although a large amount of research has been carried out around conditions such as retrieved content, service quality, and user preferences, and these have played a positive role in solving the cloud API overload problem, they cannot meet the objective needs of developers for diversified complementary cloud API recommendations in the SOA software development process. Summary of the Invention
[0004] To solve the above technical problems, the present invention provides a high-order complementary recommendation method, device and medium for cloud APIs, to solve the limitations and challenges faced in cloud API recommendation in the current intelligent software engineering field, effectively taking into account the strong and weak complementary relationships between the cloud API query set and candidate cloud APIs and eliminating the influence of the substitution relationship, and meeting the needs of developers for high-order complementary cloud APIs.
[0005] In a first aspect, the present invention provides a high-order complementary recommendation method for cloud APIs, the method comprising:
[0006] Generating a cloud API co-call relationship graph CIG, a cloud API function co-occurrence relationship graph FCG and a cloud API substitution relationship graph SRG according to the historical records of application calls to cloud APIs and the cloud API function tags;
[0007] Designing four logical operators;
[0008] Generating an embedding vector of the query cloud API;
[0009] Using the cloud API co-call relationship graph CIG and the logical operators to generate the probability that each candidate cloud API has a strong complementary relationship with the query set Q;
[0010] Using the cloud API function co-occurrence relationship graph FCG and the logical operators to generate the probability that each candidate cloud API has a weak complementary relationship with the query set Q;
[0011] Using the cloud API substitution relationship graph SRG and the logical operators to generate the probability that each candidate cloud API does not have a substitution relationship with the query set Q;
[0012] Using the union and intersection logical operators to obtain a high-order complementary probability that takes into account both strong and weak complementary relationships and eliminates the influence of the substitution relationship;
[0013] Sorting the candidate cloud APIs from largest to smallest according to the high-order complementary probability to obtain a high-order complementary cloud API recommendation list.
[0014] Further, generating a cloud API co-call relationship graph CIG, a cloud API function co-occurrence relationship graph FCG and a cloud API substitution relationship graph SRG according to the historical records of application calls to cloud APIs and the cloud API function tags, comprising:
[0015] Constructing a cloud API co-call relationship graph CIG:
[0016] CIG = (A, E CI , ε CI )
[0017] where A = {a 1 , a 2 , L a n} represents a cloud API node, a 1 , a 2 , L an represent the first, second, and nth cloud API nodes; E CI = {0, 1} represents the set of co - call relationships between nodes. 1 indicates that there is an edge depicting the co - call relationship between cloud API nodes, and 0 indicates that there is no edge depicting the co - call relationship between cloud API nodes; ε CI represents the first transformation function, which is a mapping from A×A→E CI and is used to depict the co - call relationship between cloud APIs;
[0018] Construct the cloud API functional co - occurrence relationship graph FCG:
[0019] FCG=(A, E FC , ε FC )
[0020] where E FC = {0, 1} represents the set of functional co - occurrence relationships between nodes. 1 indicates that there is an edge depicting the functional co - occurrence relationship between cloud API nodes, and 0 indicates that there is no edge depicting the functional co - occurrence relationship between cloud API nodes; ε FC represents the second transformation function, which is a mapping from A×A→E FC and is used to depict the functional co - occurrence relationship between cloud APIs;
[0021] Construct the cloud API substitution relationship graph SRG:
[0022] SRG=(A, E SR , ε SR )
[0023] where E SR = {0, 1} represents the set of substitution relationships between nodes. 1 indicates that there is an edge depicting the substitution relationship between cloud API nodes, and 0 indicates that there is no edge depicting the substitution relationship between cloud API nodes; ε SR represents the second transformation function, which is a mapping from A×A→E SR and is used to depict the substitution relationship between cloud APIs.
[0024] Further, design four logical operators, including:
[0025] Design the projection operator P under the relationship constraint r r :
[0026] P r (E(a q )) = [p r (E(a 1 )|E(a q ))), …, pr (E(a i ))|E(a q ))),…,p r (E(a n ))|E(a q ))]
[0027] Among them, P r (E(a q )) is the linking probability of aq to all candidate cloud APIs through relationship r; p r (E(a 1 ))|E(a q )) is the linking probability of a q to candidate cloud API a 1 through relationship r; p r (E(a i ))|E(a q )) is the linking probability of a q to candidate cloud API a i through relationship r; p r (E(a n ))|E(a q )) is the linking probability of a q to candidate cloud API a n through relationship r; E(a 1 ) is the embedding vector of candidate cloud API a 1 ; E(a i ) is the embedding vector of candidate cloud API a i ; E(a q ) is the embedding vector of candidate cloud API a q .
[0028] Design operator U:
[0029]
[0030] Among them is the probability that the candidate cloud API has relationship r or has relationship r 1 with ; 2 is the linking probability of to all candidate cloud APIs through relationship r 1 ; is the linking probability of to all candidate cloud APIs through relationship r 2 ; is the embedding vector of query cloud API ; is the embedding vector of query cloud API .
[0031] Design intersection operator I:
[0032]
[0033] where is the probability that the candidate cloud API has a relationship r with and has a relationship r with 1 and with has a relationship r 2 ;
[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 that the candidate cloud API does not have a relationship r with a q ; P r (E(a q )) is the link probability of a q with all candidate cloud APIs through the relationship r.
[0037] Furthermore, the embedding vector of the query cloud API is generated through the following formula:
[0038]
[0039] where EU is the embedding unit, is the embedding vector of the query cloud API .
[0040] Furthermore, using the cloud API co - call relationship graph CIG and logical operators, generate the probability that each candidate cloud API has a strong complementary relationship with the query set Q, including:
[0041] Project the cloud APIs in the query set using the co - call relationship to obtain the probability that the candidate cloud API has a strong complementary relationship with each cloud API in Q where is a query cloud API in the query set Q; is the probability that the candidate cloud API has a strong complementary relationship with the query cloud API ;
[0042] Perform the intersection operator operation on to obtain the probability that the candidate cloud API has a strong complementary relationship with Q as a whole
[0043] Further, using the cloud API 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, including:
[0044] Project the cloud APIs in the query set using the cloud API functional co-occurrence relationship to obtain the probability that the candidate cloud API has a weak complementary relationship with each cloud API in Q wherein, is the probability that the candidate cloud API and the query cloud API have a weak complementary relationship;
[0045] Perform an intersection operator operation on to obtain the probability that the candidate cloud API and Q as a whole have a weak complementary relationship
[0046] Further, using the cloud API substitution relationship graph SRG and logical operators, generate the probability that each candidate cloud API does not have a substitution relationship with the query set Q, including:
[0047] Project the cloud APIs in the query set using the substitution relationship to obtain the probability that the candidate cloud API has a substitution relationship with each cloud API in Q wherein, is the probability that the candidate cloud API and the query cloud API do not have a complementary relationship;
[0048] Perform a union operator operation on to obtain the probability that the candidate cloud API has a substitution relationship with one or more cloud APIs in Q
[0049]
[0050] Perform a negation operator operation on P SR (Q) to obtain the probability P NS (Q) = 1 - P SR (Q).
[0051] Further, using the union and intersection logical operators, obtain the high-order complementary probability that takes into account both strong and weak complementary relationships and eliminates the influence of substitution relationships, including:
[0052] Perform a union operator operation on the probability P CI (Q) that the candidate cloud API and Q as a whole have a strong complementary relationship and the probability P FC (Q) that it has a weak complementary relationship with Q to obtain the probability P that it has a strong or weak complementary relationship with QCI∪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 substitution relationship with Q as a whole NS (Q) and P CI∪FC (Q) are operated by the intersection operator to obtain the high - order complementary probability P that has a strong complementary relationship or a weak complementary relationship with Q as a whole but has no substitution 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)).
[0057] In a second aspect, the present invention provides a cloud API high - order complementary recommendation device, and the device includes:
[0058] A relationship graph generation unit, configured to generate a cloud API co - call relationship graph CIG, a cloud API function co - occurrence relationship graph FCG, and a cloud API substitution relationship graph SRG according to the cloud API historical call records of the application and the cloud API function tags;
[0059] A logical operator design unit, configured to design four logical operators;
[0060] An embedding vector generation unit, configured to generate an embedding vector of the query cloud API;
[0061] A first probability calculation unit, configured to generate the 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 the logical operator;
[0062] A second probability calculation unit, configured to generate the 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;
[0063] A third probability calculation unit, configured to generate the 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 the logical operator;
[0064] A fourth probability calculation unit, configured to obtain a high - order complementary probability that takes into account both strong and weak complementary relationships and eliminates the influence of the substitution relationship by using union and intersection logical operators;
[0065] A recommended list generation unit, configured to sort candidate cloud APIs in descending order according to the high-order complementary probability to obtain a high-order complementary cloud API recommended list.
[0066] In a third aspect, the present invention provides a readable storage medium storing one or more programs, and the one or more programs can be executed by one or more processors to implement the method as described above.
[0067] The present invention has at least the following beneficial effects:
[0068] 1. The present invention proposes a multi-perspective cloud API complementary relationship modeling solution. A common call relationship graph of cloud APIs, a function co-occurrence relationship graph of cloud APIs, and a substitution relationship graph of cloud APIs are constructed to model the complementary relationship.
[0069] 2. The present invention establishes a weak complementary relationship logical reasoning network guided by a function co-occurrence relationship graph of cloud APIs. It can enhance the performance of the recommended results while alleviating the long-tail problem that is difficult to avoid in the recommendation of complementary cloud APIs.
[0070] 3. The present invention establishes a non-substitution logical reasoning network combining a substitution relationship graph of cloud APIs and a negation operator. It can eliminate the influence of substitution relationship noise on the complementary recommendation results.
[0071] 4. The present invention proposes a high-order complementary cloud API recommendation method based on logical reasoning. The results of strong complementary relationship logical reasoning, weak complementary relationship logical reasoning, and non-substitution logical reasoning are integrated by using projection, intersection, union, and negation logical operators to meet the requirements of high-order complementary recommendation. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Figure 1 Shows an overall flowchart of a high-order complementary recommendation method for cloud APIs according to an embodiment of the present invention.
[0073] Figure 2 Shows a schematic diagram of a high-order complementary recommendation method for cloud APIs according to an embodiment of the present invention;
[0074] Figure 3 Shows a structural diagram of a high-order complementary recommendation device for cloud APIs according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0075] To enable those skilled in the art to better understand the technical solution of the present invention, the present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments. The embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings and specific examples, but it is not a limitation to the present invention. For the various steps described herein, if there is no necessity for a sequential relationship between them, the order in which they are described as examples herein should not be regarded as a limitation. Those skilled in the art should know that they can be adjusted in order as long as the logic between them is not destroyed and the entire process cannot be implemented.
[0076] An embodiment of the present invention provides a cloud API high-order complementary recommendation method. As Figure 1 shown, the cloud API high-order complementary recommendation method includes the following steps S1 to S8.
[0077] S1. Generate a cloud API co-call relationship graph CIG, a cloud API function co-occurrence relationship graph FCG, and a cloud API substitution relationship graph SRG based on the application's historical records of calling cloud APIs and the function tags of cloud APIs.
[0078] In some embodiments, step S1 specifically includes the following steps S1.1 to S1.4.
[0079] S1.1. Based on the application's historical records of calling cloud APIs and the function tags of cloud APIs, respectively form an application set M, a cloud API set A, and a tag set T, where 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 function tag set.
[0080] S1.2. Construct a cloud API-cloud API co-call relationship graph CIG:
[0081] CIG = (A, E CI , ε CI )
[0082] where A = {a 1 , a 2 , La n} represents the cloud API nodes; E CI = {0, 1} represents the set of co-call relationships between nodes, 1 indicates that there is an edge depicting the co-call relationship between cloud API nodes, and 0 indicates that there is no edge depicting the co-call relationship between cloud API nodes; the transformation function ε CI is a mapping of A × A → E CI used to depict the co-call relationship between cloud APIs.
[0083] The specific implementation is as follows:
[0084] Traverse different cloud API pairs (a i , a j ) in the cloud API set A. Based on the historical call behaviors of the applications and cloud APIs, determine whether a i and a j have been called by the same application m ∈ M, that is, whether there is a co - call relationship. If there is a co - call 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 (a i , a j ) = 0.
[0085] S1.3. Construct the cloud API - cloud API function co - occurrence relationship graph FCG:
[0086] FCG=(A, E FC , ε FC )
[0087] where A = {a 1 , a 2 , La n} represents the cloud API nodes; E FC = {0, 1} represents the set of function co - occurrence relationships between nodes. 1 means there is an edge depicting the function co - occurrence relationship between cloud API nodes, and 0 means there is no edge depicting the function co - occurrence relationship between cloud API nodes; the transformation function ε FC is a mapping from A×A→E FC , used to depict the function co - occurrence relationship between cloud APIs.
[0088] The specific implementation is as follows:
[0089] Traverse different cloud API pairs (a i , a j ) in the cloud API set A. Based on the function label set T, determine whether there is an application that has called the cloud API a p with the f i function and the cloud API a q with the f j function at the same time, 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 (ai , a j ) = 0。
[0090] S1.4. Construct the cloud API - cloud API replacement relationship graph SRG:
[0091] SRG = (A, E SR , ε SR )
[0092] where A = {a 1 , a 2 , La n} represents the cloud API nodes; E SR = {0, 1} represents the set of replacement relationships between nodes, 1 indicates that there is an edge depicting the replacement relationship between cloud API nodes, and 0 indicates that there is no edge depicting the replacement relationship between cloud API nodes; the transition function ε SR is a mapping from A × A → E SR used to depict the replacement relationship between cloud APIs.
[0093] The specific implementation is as follows:
[0094] Traverse different cloud API pairs (a i , a j ) in the cloud API set A. Based on the function label set T, determine whether there is an application that has simultaneously called the cloud API a p with function f i and the cloud API a q with function f j , that is, whether there is a functional co - occurrence relationship between a i and a j . If there is a functional 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 SRG with a weight of 1, otherwise ε FC (a i , a j ) = 0.
[0095] S2. Design four logical operators.
[0096] In some embodiments, step S2 specifically includes the following steps S2.1 to S2.4.
[0097] S2.1. Design the projection operator P r under the relationship constraint r:
[0098] P r (E(a q )) = [pr (E(a 1 )|E(a q )),…,p r (E(a i )|E(a q )),…,p r (E(a n )|E(a q ))]
[0099] Among them, P r (E(a q) ) is the link probability of a q to all candidate cloud APIs through the relationship r. The relationship constraint r includes the co-call constraint CI, the function co-occurrence constraint FC, and the substitute constraint SR.
[0100] The specific implementation is as follows:
[0101] For a given cloud API a q and the relationship r, the projection operator needs to model the link probability P i (a r |a i ) of the candidate cloud API a q . Initialize the node representation of the cloud API a i in the cloud API relationship graph as:
[0102]
[0103] where E(q) and E(r) are the embedding representations of a q and the relationship r respectively.
[0104] Iterate the cloud API relationship graph G = {CIG, FCG, SRG} T times to obtain the node representation of G that aggregates neighbor information. Feed the node representation obtained after iteratively aggregating neighbor information T times into a multi-layer perceptron (MLP), and through the Sigmoid activation function, the probability that a q is linked to the candidate cloud API under the relationship r can be obtained:
[0105]
[0106] S2.2. Design the union operator U:
[0107]
[0108] S2.3. Design the intersection operator I:
[0109]
[0110] S2.4. Design the negation operator N:
[0111] N(P r (E(a q )))=1 - P r (E(a q ))
[0112] S3. Generate the embedding vector of the query cloud API.
[0113] In some embodiments, one - hot encoding is used in this embodiment to generate the embedding vector of the query cloud API, and the calculation formula is:
[0114]
[0115] S4. Use the co - call relationship graph CIG and logical operators to generate the probability that each candidate cloud API has a strong complementary relationship with the query set Q.
[0116] In some embodiments, step S4 specifically includes the following steps S4.1 and S4.2.
[0117] S4.1. Project the cloud APIs in the query set using the co - call relationship to obtain the probability that each candidate cloud API has a strong complementary relationship with each cloud API in Q
[0118]
[0119] S4.2. After performing the intersection operator operation on , obtain the probability that the candidate cloud API has a strong complementary relationship with Q as a whole
[0120] S5. Use the function co - occurrence relationship graph FCG and logical operators to generate the probability that each candidate cloud API has a weak complementary relationship with the query set Q.
[0121] In some embodiments, step S5 specifically includes the following steps S5.1 and S5.2.
[0122] S5.1. Project the cloud APIs in the query set using the cloud API function co - occurrence relationship to obtain the probability that each candidate cloud API has a weak complementary relationship with each cloud API in Q
[0123]
[0124] S5.2. After performing the intersection operator operation on , obtain the probability that the candidate cloud API has a weak complementary relationship with Q as a whole
[0125] S6. Generate the probability that each candidate cloud API has no substitution relationship with the query set Q by using the substitution relationship graph SRG and logical operators.
[0126] In some embodiments, step S6 specifically includes the following steps S6.1 to S6.3.
[0127] S6.1. Project the cloud APIs in the query set using the substitution relationship to obtain the probability that the candidate cloud API has a substitution relationship with each cloud API in Q
[0128]
[0129] S6.2. Perform the union operator operation on to obtain the probability that the candidate cloud API has a substitution relationship with one or more cloud APIs in Q
[0130]
[0131] S6.3. Perform the negation operator operation on P SR (Q) to obtain the probability P NS (Q) that the candidate cloud API has no substitution relationship with all cloud APIs in Q: P SR (Q) = 1 - P
[0132] S7. Use the union and intersection logical operators to obtain the high-order complementary probability that takes into account the strong and weak complementary relationships and eliminates the influence of the substitution relationship.
[0133] In some embodiments, step S7 specifically includes the following steps S7.1 to S7.2.
[0134] S7.1. Perform the union operator operation on 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 to obtain the probability P CI∪FC (Q) of having a strong or weak complementary relationship with Q:
[0135] P CI∪FC (Q) = U(P CI (Q), P FC (Q))
[0136] S7.2. Perform the intersection operator operation on the probability P NS (Q) that the candidate cloud API has no substitution relationship with Q as a whole and P CI∪FC (Q) to obtain the high-order complementary probability P (CI∪FC)∩NS (Q) of having a strong or weak complementary relationship with Q as a whole but no substitution relationship:
[0137] P (CI∪FC)∩NS (Q) = I(P CI∪FC (Q), P NS (Q)) = I(U(P CI (Q), P FC (Q)), P NS (Q))
[0138] S8. Sort the candidate cloud APIs in descending order according to the high - order complementary probability to obtain a recommended list of high - order complementary cloud APIs.
[0139] In some embodiments, the calculation formula for sorting the candidate cloud APIs in descending order according to the high - order complementary probability to obtain a recommended list of high - order complementary cloud APIs is:
[0140]
[0141] During the training process, the model parameters are updated by minimizing binary cross - entropy.
[0142]
[0143] Where Q is the query set, A Q is the set of complementary terms having a complementary relationship with Q, is the set of non - complementary terms having no complementary relationship with Q, and P(a|Q) is the complementary probability of the LRN4HCAR predicting the candidate cloud API a and the query set Q. By maximizing the complementary probability between the complementary terms and Q and minimizing the complementary probability between the non - complementary terms and Q, it helps the model obtain better learning effects.
[0144] In the above - mentioned embodiments, the embodiments of the present invention provide a high - order complementary recommendation method for cloud APIs based on logical operators. Different from the existing cloud API recommendation methods, the present invention proposes a multi - perspective modeling method for the complementary relationship of cloud APIs. Construct a co - call relationship graph of cloud APIs, a co - occurrence relationship graph of cloud API functions, and a substitution relationship graph of cloud APIs to model the complementary relationship; at the same time, the present invention establishes a weak complementary relationship logical reasoning network guided by the co - occurrence relationship graph of cloud API functions. It can not only enhance the performance of the recommendation results by using weak complementary relationships, but also alleviate the long - tail problem that is difficult to avoid in complementary cloud API recommendations; at the same time, the present invention establishes a non - substitution logical reasoning network combining the substitution relationship graph of cloud APIs and the negation operator. It can eliminate the influence of substitution relationship noise on the complementary recommendation results; at the same time, the present invention proposes a high - order complementary recommendation method for cloud APIs based on logical operators. Using projection, intersection, union, and negation logical operators to synthesize the results of strong complementary relationship logical reasoning, weak complementary relationship logical reasoning, and non - substitution logical reasoning, it meets the requirements of the high - order nature of complementary recommendations.
[0145] The embodiments of the present invention also provide a high - order complementary recommendation device for cloud APIs, such asFigure 3 As shown in the figure, the device includes:
[0146] A relationship graph generation unit 301, configured to generate a cloud API co - call relationship graph CIG, a cloud API function co - occurrence relationship graph FCG, and a cloud API substitution relationship graph SRG according to the application call cloud API history and the cloud API function tags;
[0147] A logical operator design unit 302, configured to design four logical operators;
[0148] An embedding vector generation unit 303, configured to generate an embedding vector for querying cloud APIs;
[0149] A first probability calculation unit 304, configured to use the cloud API co - call relationship graph CIG and logical operators to generate the probability that each candidate cloud API has a strong complementary relationship with the query set Q;
[0150] A second probability calculation unit 305, configured to use the cloud API function co - occurrence relationship graph FCG and logical operators to generate the probability that each candidate cloud API has a weak complementary relationship with the query set Q;
[0151] A third probability calculation unit 306, configured to use the cloud API substitution relationship graph SRG and logical operators to generate the probability that each candidate cloud API does not have a substitution relationship with the query set Q;
[0152] A fourth probability calculation unit 307, configured to use union and intersection logical operators to obtain a high - order complementary probability that takes into account both strong and weak complementary relationships and eliminates the influence of substitution relationships;
[0153] A recommended list generation unit 308, configured to sort the candidate cloud APIs in descending order according to the high - order complementary probability to obtain a high - order complementary cloud API recommended list.
[0154] It should be noted that the structure of each cloud API high - order complementary recommendation device described in this embodiment belongs to the same technical concept as the previously described cloud API high - order complementary recommendation method, and achieves the same beneficial effects through the same principle, which will not be elaborated here.
[0155] An embodiment of the present invention also provides a readable storage medium, where the readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method described in any of the above embodiments.
[0156] The foregoing description is intended to be illustrative and not restrictive. For example, the above examples (or one or more aspects thereof) may be used in combination with each other. For instance, other embodiments may be utilized by those of ordinary skill in the art upon reading the above description. Additionally, in the above detailed description, various features may be grouped together to simplify the present invention. This should not be construed as an intention that the features of an unclaimed invention are necessary for any claim. On the contrary, the subject matter of the present invention may be less than all of the features of a particular embodiment of the invention. Thus, the following claims are hereby incorporated into the detailed description by way of example or embodiment, where each claim stands on its own as a separate embodiment, and it is contemplated that these embodiments may be combined with each other in various combinations or permutations. The scope of the present invention should be determined with reference to the appended claims and the full scope of equivalents to which those claims are entitled.
Claims
1. A cloud API high-level complementary recommendation method, characterized in that: The method comprises: Generate the cloud API common call relationship graph CIG, cloud API function co-occurrence relationship graph FCG and cloud API substitute relationship graph SRG based on the application call cloud API history and cloud API function labels; Design four logical operators; Generate embedding vectors for querying cloud APIs; Using the cloud API common call relationship graph CIG and logical operators, generate the probability that each candidate cloud API has a strong complementary relationship with the query set Q; Using the cloud API function 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; Using the cloud API substitute relationship graph SRG and logical operators, generate the probability that each candidate cloud API has no substitute relationship with the query set Q; By using the union and intersection logic operators, we can obtain the high-order complementary probability that takes into account both the strong and weak complementary relationships and eliminates the influence of the substitute relationship. According to the high-order complementary probability, the candidate cloud APIs are sorted from large to small to obtain a recommended list of high-order complementary cloud APIs.
2. The cloud API high-level complementary recommendation method according to claim 1, characterized in that: Based on the application call cloud API history and cloud API function labels, the cloud API common call relationship graph CIG, cloud API function co-occurrence relationship graph FCG and cloud API substitute relationship graph SRG are generated, including: Construct the cloud API common call relationship diagram CIG: CIG=(A,E CI ,ε CI ) Where A={a1,a2,L a n } represents the cloud API node, a1, a2, Lan represent the first, second and nth cloud API nodes; E CI ={0,1} represents the set of common call relationships between nodes, 1 represents the existence of edges that depict common call relationships between cloud API nodes, and 0 represents the absence of edges that depict common call relationships between cloud API nodes; ε CI represents the first conversion function, which is A×A→E CI The mapping is used to describe the common calling relationship between cloud APIs. Construct the cloud API function co-occurrence graph FCG: FCG=(A,E FC ,ε FC ) Where E FC ={0,1} represents the set of function co-occurrence relationships between nodes, 1 represents the existence of edges between cloud API nodes that depict function co-occurrence relationships, and 0 represents the absence of edges between cloud API nodes that depict function co-occurrence relationships; ε FC represents the second conversion function, which is A×A→E FC The mapping is used to characterize the functional co-occurrence relationship between cloud APIs; Constructing the Cloud API Substitute Relationship Graph SRG: SRG=(A,E SR ,ε SR , Where E SR ={0,1} represents the set of substitute relationships between nodes, 1 represents the existence of an edge that describes a substitute relationship between cloud API nodes, and 0 represents the absence of an edge that describes a substitute relationship between cloud API nodes; ε SR represents the second conversion function, which is A×A→E SR A mapping is used to describe the substitution relationship between cloud APIs.
3. The cloud API high-level complementary recommendation method according to claim 1, characterized in that: Design four logical operators, including: Design a projection operator P under the 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 the link probability of aq with all candidate cloud APIs through relationship r; p r (E(a1)|E(a q )) is a q The link probability between relation r and candidate cloud APIa1; p r (E(a i )|E(a q )) is a q Through the relationship r and candidate cloud API a i The link probability p r (E(a n )|E(a q )) is a q Through the relationship r and candidate cloud API a n ; E(a1) is the embedding vector of candidate cloud APIa1; E(a i ) is a candidate cloud APIa i The embedding vector of q ) is a candidate cloud APIa q The embedding vector of Design and operator U: in Is a candidate cloud API with Has relationship r1 or with The probability of having relationship r2; yes The link probability of relation r1 with all candidate cloud APIs; yes The link probability with all candidate cloud APIs through relationship r2; Is the query cloud API The embedding vector of Is the query cloud API The embedding vector of Design intersection operator I: in Is a candidate cloud API with has a relationship r1 and The probability of having relationship r2; Design the negation operator N: N(P r (And(the q )))=1-P r (And(the q )) Where N(P r (E(a q ))) is a candidate cloud API that is not compatible with a q The probability of having relation r; P r (E(a q )) is a q The link probability of relation r with all candidate cloud APIs.
4. The cloud API high-level complementary recommendation method according to claim 1, characterized in that: The embedding vector for querying the cloud API is generated using the following formula: Among them, EU is the embedding unit, To query the cloud API The embedding vector of .
5. The cloud API high-level complementary recommendation method according to claim 3, characterized in that: The cloud API common call relationship graph CIG and logical operators are used to generate the probability that each candidate cloud API has a strong complementary relationship with the query set Q, including: The query set The cloud APIs in Q are projected using the common call relationship 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 the query set Q; Candidate Cloud API and Query Cloud API The probability of having a strong complementary relationship; Will After the intersection operator operation, the probability that the candidate cloud API has a strong complementary relationship with Q as a whole is obtained.
6. The cloud API high-level complementary recommendation method according to claim 5, characterized in that: The cloud API function co-occurrence graph FCG and logical operators are used to generate the probability that each candidate cloud API has a weak complementary relationship with the query set Q, including: The query set The cloud APIs in Q are projected using the cloud API function co-occurrence relationship to obtain the probability that the 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; Will After the intersection operator operation, the probability that the candidate cloud API has a weak complementary relationship with Q as a whole is obtained.
7. The cloud API high-level complementary recommendation method according to claim 5, characterized in that: Using the cloud API substitute relationship graph SRG and logical operators, the probability that each candidate cloud API has no substitute relationship with the query set Q is generated, including: The query set The cloud APIs in Q are projected using the substitute relationship to obtain the probability that the candidate cloud API has a substitute relationship with each cloud API in Q. in, Candidate Cloud API and Query Cloud API The probability of not having a complementary relationship; Will After the union operation, we get the probability that the candidate cloud API has a substitute relationship with one or more cloud APIs in Q. P SR (Q) performs the inverse operator operation to obtain the probability P that the candidate cloud API has no substitute relationship with all cloud APIs in Q NS (Q) = 1-P SR (Q).
8. The cloud API high-level complementary recommendation method according to claim 5, characterized in that: By using the union and intersection logic operators, we can obtain the high-order complementary probability that takes into account both the strong and weak complementary relationship and eliminates the influence of the substitute relationship, including: The probability P that the candidate cloud API has a strong complementary relationship with Q as a whole CI (Q) and the probability P of having a weak complementary relationship with Q FC (Q), after the union operator operation, we get the probability P of having a strong complementary relationship or a weak complementary relationship with Q CI∪FC (Q): P CI∪FC (Q)=U(P CI (Q),P FC (Q)) The probability P that the candidate cloud API has no substitute relationship with Q as a whole NS (Q) and P CI∪FC (Q) After the intersection operator operation, the high-order complementary probability P with Q as a whole is obtained, which has a strong complementary relationship or a weak complementary relationship but does not have a substitute relationship. (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))。 9. A cloud API high-level complementary recommendation device, characterized in that: The device comprises: A relationship graph generating unit is configured to generate 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 according to the application calling cloud API history records and cloud API function labels; The logic operator design unit is configured to design four logic operators; An embedding vector generation unit, configured to generate an embedding vector for querying a cloud API; A first probability calculation unit 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 common call relationship graph CIG and a logical operator; A second probability calculation unit 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; A third probability calculation unit is configured to generate a probability that each candidate cloud API has no substitute relationship with the query set Q by using the cloud API substitute relationship graph SRG and a logical operator; The fourth probability calculation unit is configured to use the union and intersection logic operators to obtain a high-order complementary probability that takes into account both the strong and weak complementary relationships and eliminates the influence of the substitute relationship; The recommendation list generating unit is configured to sort the candidate cloud APIs from large to small according to the high-order complementary probability to obtain a high-order complementary cloud API recommendation list. 10 . A non-transitory computer-readable storage medium storing instructions, which, when executed by a processor, perform the method according to claim 1 .
Citation Information
Patent Citations
Function label driven LDA-based cloud API complementary recommendation method
CN117215677A
High-order complementary cloud API recommendation method based on logical reasoning
CN118277667A
Web API function complementation recommendation method based on learning model
CN118349746A
Cited By
Cloud API complementary recommendation method and device based on decoupling attribute co-occurrence graph representation learning, equipment and storage medium
CN121636824A