A cloud API complementary recommendation method based on logical reasoning and trace correction

Through a method based on logical reasoning and abductive correction, the problems of existing cloud API recommendation methods that do not model complementary relationships and do not correct results are solved, and accurate recommendations and improved effects of cloud APIs are achieved.

CN119903085BActive Publication Date: 2025-10-17YANSHAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411960969.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-10-17
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

Existing cloud API recommendation methods ignore developers' needs for complementary cloud APIs, fail to effectively model weak complementary relationships and eliminate the impact of substitute noise, and do not correct the recommendation results, resulting in poor recommendation effects.

Method used

A method based on logical reasoning and abductive correction is adopted to convert the query cloud API into a probabilistic embedding vector. The complementary embedding vector is obtained using the logical reasoning unit, and the complementary basis vector is obtained through the attention network. The KL divergence score is calculated. After sorting, the abductive model is used to correct the recommendation results to eliminate the influence of substitute noise.

Benefits of technology

It achieves accurate modeling of complementary relationships and correction of recommendation results, provides more accurate cloud API recommendations, meets developers' actual needs for complementary cloud APIs, and improves recommendation effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119903085B_ABST
    Figure CN119903085B_ABST
Patent Text Reader

Abstract

The application discloses a cloud API complementary recommendation method based on logical reasoning and trace correction, and belongs to the technical field of intelligent software engineering, and comprises the following steps: converting a query cloud API into a corresponding probability embedding vector; obtaining a complementary embedding vector of each query cloud API by using a logical reasoning unit; obtaining a complementary base vector complementary to the whole query set by using an attention network; obtaining a complementary score by using the KL divergence between the complementary base vector and a candidate cloud API; sorting the candidate cloud APIs according to the complementary score from large to small to obtain a complementary recommendation list; inferring the reason most likely to be complementary to the recommendation result by using a trace model; obtaining a trace loss by using the difference between the inferred reason and the real reason; correcting the recommendation result by minimizing the trace loss through back propagation; and re-sorting the candidate cloud APIs according to the complementary score after correction. The application can effectively model the complementary relationship and correct the recommendation result.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intelligent software engineering, and particularly relates to a cloud API complementary recommendation method based on logical reasoning and trace correction. BACKGROUND

[0002] In the cloud era, cloud API is the best carrier for service delivery, data exchange and capability replication. The exponential growth of cloud API in the dynamic open network provides developers with more choices, but at the same time, it also makes developers overwhelmed in a large number of cloud APIs. Therefore, designing an effective cloud API recommendation method is crucial for the healthy development of cloud API economy. Existing cloud API recommendation methods mainly recommend cloud APIs with similar preferences, single functions and high quality for developers from three perspectives of user-side historical interaction, function-side content matching and non-function-side service quality perception.

[0003] However, the existing cloud API recommendation method ignores the needs of developers for complementary cloud APIs. The existing complementary relationship modeling method often models strong complementary relationships from the perspective of joint invocation, but ignores the modeling of weak complementary relationships from the perspective of function co-occurrence, and fails to effectively eliminate the influence of substitution noise. In addition, the existing cloud API recommendation method generates a recommendation result in one step, and does not consider correcting the recommendation result to further improve the recommendation effect. SUMMARY

[0004] The technical problem to be solved by the present application is to provide a cloud API complementary recommendation method based on logical reasoning and trace correction, which can effectively model the complementary relationship and correct the recommendation result, provide more accurate cloud API recommendation for users, and effectively meet the objective needs of developers for complementary cloud APIs in the service-oriented software development process.

[0005] To solve the above technical problems, the technical scheme adopted by the present application is as follows:

[0006] A cloud API complementary recommendation method based on logical reasoning and trace correction, comprising the following steps:

[0007] S1, converting a query cloud API into a corresponding probability embedding vector;

[0008] S2, obtaining a complementary embedding vector corresponding to each query cloud API by using a logical reasoning unit;

[0009] S3, obtaining a complementary base vector complementary to the query set as a whole by using an attention network;

[0010] S4, obtaining a complementary score by using the KL divergence between the complementary base vector and the candidate cloud API;

[0011] S5, rank the candidate cloud APIs from large to small according to the complementary scores to obtain a complementary recommendation list;

[0012] S6, infer the reason most likely to be complementary to the recommendation result by using a provenance model;

[0013] S7, obtain provenance loss by using the difference between the inferred reason and the real reason;

[0014] S8, correct the recommendation result by back propagation with the provenance loss minimized;

[0015] S9, re-rank the candidate cloud APIs from large to small according to the corrected complementary scores.

[0016] Further improvement of the technical scheme of the application is that in S1, specifically comprising: converting each query cloud API in the query set Q into a corresponding probability embedding vector:

[0017] PEU(q i )=E(q i )

[0018] E(q i )=([e αi_1 ,e αi_2 ,...,e αi_d ],[e βi_1 ,e βi_2 ,...,e βi_d ])=[α i ,β i ]

[0019] Wherein, PEU is a probability embedding unit; E(q i ) is a Beta probability embedding vector corresponding to the query cloud API q i ; the Beta probability embedding vector is determined by two parameters alpha and beta; each query cloud API contains d hidden features, and the kth hidden feature of the query cloud API q i is represented by Beta distribution Beta(e αi_k ,e βi_k ).

[0020] Further improvement of the technical scheme of the application is that in S2, specifically comprising the following steps:

[0021] S2.1, design a projection operator PJ r under the relationship constraint r, as shown in the following formula:

[0022] PJ r (E(q i ))=MLP(concat(E(r),E(q i ))

[0023] wherein the relation constraint r includes the complement constraint sc and the co-call constraint cc; MLP is a multi-layer perception; E(r) is a Beta probability embedding vector corresponding to the relation constraint r; E(q i ) is a Beta probability embedding vector corresponding to the query cloud API q i ;

[0024] The embedding vector of the query cloud API under the relation constraint r can be obtained through the projection operator PJ r ;

[0025] S2.2, a negation operator NG is designed, as shown in the following formula:

[0026] NG(E(q i )) = E(q i ) NG

[0027] wherein E(q i ) NG is the embedding vector after negation;

[0028] S2.3, an intersection and union operator IS is designed, as shown in the following formula:

[0029] IS(E(q1),...,E(q n )) = E(q) IS

[0030] wherein E(q) IS is the embedding vector obtained after applying the intersection and union operator;

[0031] S2.4, complementary relation logical reasoning:

[0032] First, the embedding vector E(q) corresponding to each query cloud API q is projected under the complement constraint sc to obtain the embedding vector with a complementary relation to the query cloud API, and then projected under the co-call constraint cc; At this time, the embedding vector E(q) sc-cc with a weak complementary relation to the query cloud API is obtained, as shown in the following formula:

[0033] E(q) sc-cc = PJ cc (PJ sc (E(q)))

[0034] Since any cloud API is complementary to itself, E(q) sc-cc also takes into account the strong complementary relation;

[0035] S2.5, non-complementary relation logical reasoning:

[0036] First, the projection of the embedding vector E(q) corresponding to each query cloud API q under the complement constraint sc is carried out, and the embedding vector with a complementary relationship with the query cloud API is obtained; then the negation operator is used to obtain the embedding vector E(q) sc-NG , and the influence of the complementary noise is eliminated, as shown in the following formula:

[0037] E(q) sc-NG = NG(PJ sc (E(q)))

[0038] S2.6, the intersection and union operator is applied to obtain the complementary embedding vector E(q) of the query cloud API q IS , as shown in the following formula:

[0039] E(q) IS = IS(E(q) sc-cc ,E(q) sc-NG )

[0040] Through the reasoning of S2.4, S2.5 and S2.6, the logical reasoning unit considering strong and weak complementary relationship and eliminating the influence of complementary noise is obtained.

[0041] Further improvement of the technical scheme of the application is that in S3, specifically comprising: using attention network Att to obtain complementary base vector E(Q) complementary to the query set Q as a whole base , as shown in the following formula:

[0042] E(Q) base = Att({E(q1),...E(q t ),...E(q T )})

[0043] The attention network is adopted because different query cloud APIs have different importance for generating recommended results, and the recommended candidate cloud API is required to be complementary to the query set as a whole.

[0044] Further improvement of the technical scheme of the application is that in S4, specifically comprising: using the KL divergence between the complementary base vector E(Q) base and the candidate cloud API c embedding vector E(c) to obtain the complementary score y, as shown in the following formula:

[0045]

[0046] Wherein, epsilon is a hyperparameter and its value is greater than 0; d is the number of hidden features contained in the cloud API; q j (x) is the probability density function corresponding to the jth hidden feature of E(Q) base j ​(x) is the probability density function corresponding to the jth hidden feature of E(c);KL divergence can measure the distance between two probability distribution functions;

[0047] E(Q) base The smaller the distance between E(c) hidden features is, the higher the complementary degree between the query set and the candidate cloud API is, that is, the greater the complementary score is.

[0048] The further improvement of the technical scheme of the application is that in S5, specifically comprising: sorting the candidate cloud API according to the complementary score from large to small to obtain a complementary recommendation list CRL, as shown in the following formula:

[0049]

[0050] Wherein, c i is the ith candidate cloud API after sorting; is the complementary score corresponding to c i .

[0051] The further improvement of the technical scheme of the application is that in S6, specifically comprising the following steps:

[0052] S6.1, because the recommendation result is generated by the query set, any query cloud API in the query set can be used as a real reason q t for generating the recommendation result, as shown in the following formula:

[0053] Sample(Q)=q t

[0054] Wherein, Sample adopts random sampling;

[0055] S6.2, in order to prevent the introduction of too much irrelevant information and cause overcorrection phenomenon, only the first K AC candidate cloud API in CRL is selected as the object of traceability and correction, as shown in the following formula:

[0056]

[0057] Wherein, L is the input of the traceability task and the list of candidate cloud API to be corrected;

[0058] S6.3, in order to depict the importance of different candidate cloud API, the complementary score corresponding to the candidate cloud API is converted into weight, as shown in the following formula:

[0059]

[0060] Wherein, is the weight corresponding to the candidate cloud API c jcorresponding weight; σ is a sigmoid activation function; γ is a hyperparameter and its value is greater than 0 to smooth the complementary score after activation;

[0061] S6.4, generating a comprehensive cloud API by using the obtained weight As shown in the following formula:

[0062]

[0063] Comprehensive cloud API representing the recommendation result generated in step S5;

[0064] S6.5, using the provenance model f AM Infer the reason most likely to be complementary to the recommendation result As shown in the following formula:

[0065]

[0066] Provenance model f AM The method used in the complementary recommendation stage has the same structure; y qt The greater the difference between the inferred reason and the true reason q t The smaller the difference between the inferred reason and the true reason q t .

[0067] Further improvement of the technical scheme of the present application is that in S7, specifically comprising: obtaining the provenance loss Aloss between the inferred reason and the true reason q t As shown in the following formula:

[0068]

[0069] Wherein, σ is a sigmoid activation function; representing the difference between the inferred reason and the true reason q t .

[0070] Further improvement of the technical scheme of the present application is that in S8, specifically comprising: correcting the recommendation result by minimizing the provenance loss in reverse propagation, as shown in the following formula:

[0071]

[0072] Wherein, is the complementary score corresponding to the candidate cloud API c j , and c j ∈L.

[0073] Further improvement of the technical scheme of the present application is that in S9, specifically comprising: reordering the candidate cloud API from large to small according to the complementary score after correction, as shown in the following formula:

[0074] CRL' = rank(L)

[0075] Wherein, CRL' is the complementary recommendation list after reordering.

[0076] Due to the adoption of the above technical scheme, the present application has achieved the following technical progress:

[0077] 1. The present application converts each query cloud API into a corresponding probability embedding vector; obtains a complementary embedding vector corresponding to each query cloud API through a logical reasoning unit; obtains a complementary basis vector complementary to the query set as a whole through an attention network; obtains a complementary score through the KL divergence between the complementary basis vector and the candidate cloud API; generates a complementary recommendation list by ordering from large to small according to the complementary score; infers the reason why the recommendation result is most likely to be complementary through a provenance model; obtains a provenance loss through the difference between the inferred reason and the real reason; minimizes the provenance loss to correct the recommendation result through back propagation; reorders the candidate cloud API that has been corrected from large to small; compared with most methods, it makes service recommendations in the dimension of cloud API complementarity, which can meet the actual needs of developers for complementary cloud API recommendations.

[0078] 2. In the present application, the logical reasoning unit is used to model the complementary relationship in combination with cloud API joint invocation and function co-occurrence, and can effectively eliminate the influence of substitution noise.

[0079] 3. Unlike traditional schemes that cannot correct the recommendation result, the cloud API complementary recommendation method based on logical reasoning and provenance correction provided by the present application can correct the recommendation result through provenance correction, thereby further improving the recommendation effect. BRIEF DESCRIPTION OF DRAWINGS

[0080] In order to more clearly illustrate the technical scheme in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor;

[0081] Fig. 1 is a flowchart of a cloud API complementary recommendation method based on logical reasoning and provenance correction provided in an embodiment of the present application;

[0082] Fig. 2 is a schematic diagram of a cloud API complementary recommendation method based on logical reasoning and provenance correction provided in an embodiment of the present application;

[0083] Fig. 3 This is a schematic diagram of the complementary recommendation stage in a cloud API complementary recommendation method based on logical reasoning and abductive correction provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0084] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products or apparatuses.

[0085] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments:

[0086] like Figs. 1-3 As shown, a cloud API complementary recommendation method based on logical reasoning and abductive correction includes a complementary recommendation stage (S1-S5) and an abductive correction stage (S6-S9), specifically including the following steps:

[0087] S1. Convert the query cloud API into the corresponding probability embedding vector;

[0088] The specific Beta probability embedding vector used is shown in the following formula:

[0089] PEU(q i )=E(q i )

[0090] E(q i )=([e αi_1 ,e αi_2 ,...,e αi_d ],[e βi_1 ,e βi_2 ,...,e βi_d ])=[α i ,β i ]

[0091] Among them, PEU is the probability embedding unit; E(q i ) is the query cloud API q i The corresponding Beta probability embedding vector; the Beta probability embedding vector is determined by two parameters α and β; each query cloud API contains d hidden features, query cloud API q i The kth latent feature is distributed by Beta (e αi_k ,e βi_k )express.

[0092] S2, obtaining the complementary embedding vector corresponding to each query cloud API by using the logical reasoning unit;

[0093] Specifically comprising the following steps:

[0094] S2.1, designing a projection operator PJ under the relation constraint r r As shown in the following formula:

[0095] PJ r (E(q i ))=MLP(concat(E(r),E(q i )))

[0096] Wherein, the relation constraint r includes the complementary constraint sc and the common call constraint cc. MLP is a multi-layer perception machine, and E(r) is a Beta probability embedding vector corresponding to the relation constraint r. The embedding vector of the query cloud API under the relation constraint r can be obtained through the projection operator PJ r .

[0097] S2.2, designing a negation operator NG, as shown in the following formula:

[0098] NG(E(q i ))=NG((α i ,β i ))=[α i NG ,β i NG ]

[0099] Wherein, α i NG =1 / α i , β i NG =1 / β i .

[0100] S2.3, designing an intersection and union operator IS, as shown in the following formula:

[0101]

[0102] Wherein,

[0103] S2.4, complementary relation logical reasoning:

[0104] First, the embedding vector E(q) corresponding to each query cloud API q is projected under the complementary constraint sc to obtain the embedding vector with a complementary relation to the query cloud API, and then projected under the common call constraint cc. At this time, the embedding vector E(q) sc-cc with a weak complementary relation to the query cloud API can be obtained, as shown in the following formula:

[0105] E(q) sc-cc = PJ cc (PJ sc (E(q)))

[0106] Since any cloud API is its own antonym, E(q) sc-cc also takes into account the strong complementary relationship.

[0107] S2.5, non-replacement relationship logical reasoning:

[0108] First, the projection of the embedding vector E(q) corresponding to each query cloud API q under the replacement constraint sc is carried out, and the embedding vector with replacement relationship with the query cloud API is obtained. Then the negation operator is used to obtain the embedding vector E(q) sc-NG , and then eliminate the influence of replacement noise, as shown in the following formula:

[0109] E(q) sc-NG = NG(PJ sc (E(q)))

[0110] S2.6, the intersection and union operator is applied to obtain the complementary embedding vector E(q) IS of the query cloud API q, as shown in the following formula:

[0111] E(q) IS = IS(E(q) sc-cc , E(q) sc-NG )

[0112] Through the reasoning of S2.4, S2.5 and S2.6, the logical reasoning unit considering strong and weak complementary relationship and eliminating replacement noise influence can be obtained.

[0113] S3, using attention network Att to obtain complementary base vector E(Q) complementary to the whole query set Q base , as shown in the following formula:

[0114] E(Q) base = Att({E(q1),...E(q t ),...E(q T )}) = [α base , β base ]

[0115] Among them,

[0116] The attention network is adopted because different query cloud APIs have different importance for generating recommended results, and the recommended candidate cloud API is required to be complementary to the whole query set.

[0117] S4, using the complementary base vector E(Q)base and the KL divergence between the candidate cloud API c embedding vector E(c) gets the complementary score y, as shown in the following formula:

[0118]

[0119] wherein ε is a hyperparameter and its value is greater than 0, q j (x) is E(Q) base The jth hidden feature corresponds to the probability density function p j (x) is the probability density function corresponding to the jth hidden feature of E(c). The KL divergence can measure the distance between two probability distribution functions, E(Q) base The smaller the distance between the hidden features of E(Q) and E(c) is, the higher the complementary degree between the query set and the candidate cloud API is, that is, the greater the complementary score is.

[0120] S5, sort the candidate cloud API according to the complementary score from large to small to get the complementary recommendation list CRL, as shown in the following formula:

[0121]

[0122] wherein c i is the ith candidate cloud API after sorting; is the complementary score corresponding to c i .

[0123] S6, use the trace model to infer the reason that is most likely complementary to the recommendation result;

[0124] Specifically, the following steps are included:

[0125] S6.1, because the recommendation result is generated from the query set, any query cloud API in the query set can be used as the real reason q t for generating the recommendation result, as shown in the following formula:

[0126] Sample(Q)=q t

[0127] wherein Sample uses random sampling.

[0128] S6.2, in order to prevent the introduction of too much irrelevant information and cause overcorrection, only the top K AC candidate cloud APIs in CRL are selected as the objects of trace and correction, as shown in the following formula:

[0129]

[0130] wherein L is the input of the trace task and the list of candidate cloud APIs that need to be corrected.

[0131] S6.3, To characterize the importance of different candidate cloud APIs, the complementary scores corresponding to the candidate cloud APIs are converted into weights as follows:

[0132]

[0133] wherein, is the weight of the candidate cloud API c j , σ is a sigmoid activation function, and γ is a hyperparameter with a value greater than 0 for smoothing the complementary score after activation.

[0134] S6.4, The comprehensive cloud API is generated using the obtained weights as follows:

[0135]

[0136] The comprehensive cloud API represents the recommendation result generated in step S5.

[0137] S6.5, The provenance model f AM is used to infer the reason most likely complementary to the recommendation result as follows:

[0138]

[0139] For simplicity, the provenance model f AM has the same structure as the method used in the complementary recommendation stage (complementary recommendation model). The greater the value of f , the smaller the difference between the inferred reason t and the true reason q .

[0140] S7, The provenance loss Aloss is obtained using the difference between the inferred reason and the true reason q t as follows:

[0141] Aloss = -log(σ(y qt ))

[0142] wherein, σ is a sigmoid activation function; y qt represents the difference between the inferred reason and the true reason q t .

[0143] S8, The recommendation result is corrected by backpropagation with the provenance loss minimized as follows:

[0144]

[0145] wherein, for the candidate cloud API c j a corresponding complementary score, and c j ∈ L.

[0146] S9, reordering the candidate cloud APIs in descending order of the corrected complementary scores, as follows:

[0147] CRL' = rank(L)

[0148] where CRL' is the complementary recommendation list after reordering.

[0149] In summary, the present application converts each query cloud API into a corresponding Beta probability embedding vector; obtains a complementary embedding vector corresponding to each query cloud API through a logical reasoning unit; obtains a complementary basis vector complementary to the query set as a whole using an attention network; obtains a complementary score using the KL divergence between the complementary basis vector and the candidate cloud API; generates a complementary recommendation list by ordering the candidate cloud APIs in descending order of the complementary scores; infers the reason why the recommendation result is most likely to be complementary using a provenance model; obtains a provenance loss using the difference between the inferred reason and the true reason; corrects the recommendation result by minimizing the provenance loss through backpropagation; and reorders the corrected candidate cloud APIs in descending order. This method provides more accurate cloud API recommendations for users, effectively meeting the objective needs of developers for complementary cloud APIs in the service-oriented software development process.

[0150] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A cloud API complementary recommendation method based on logical reasoning and abductive correction, characterized by: The following steps are involved: S1. Convert the query cloud API into the corresponding probability embedding vector; S2. Use the logical reasoning unit to obtain the complementary embedding vector corresponding to each query cloud API; S3. Use the attention network to obtain complementary basis vectors that are complementary to the query set as a whole; Specifically include: using attention network Att Get and query set Q Globally complementary complementary basis vectors E ( Q ) base , as shown below: ; The attention network is used because different query cloud APIs have different importance in generating recommendation results, and the recommended candidate cloud APIs are required to be complementary to the query set as a whole; S4, using the KL divergence between the complementary basis vectors and the candidate cloud API to obtain the complementary score; Specifically include: using complementary basis vectors E ( Q ) base and candidate cloud APIs c Embedding vector E ( c ) to obtain the complementary score y , as shown below: ; in, It is a hyperparameter and its value is greater than 0; d The number of hidden features contained in the cloud API; q j ( x )yes E ( Q ) base No. j The probability density function corresponding to each latent feature; p j ( x )for E ( c ) No. j The probability density function corresponding to each latent feature; KL divergence can measure the distance between two probability distribution functions; E ( Q ) base and E ( c The smaller the distance between the latent features, the higher the degree of complementarity between the query set and the candidate cloud APIs, that is, the larger the complementarity score; S5. Sort the candidate cloud APIs by their complementary scores from largest to smallest to obtain a complementary recommendation list; S6. Use the abductive model to infer the reasons that are most likely to complement the recommended results; S7, using the difference between the inferred cause and the true cause to obtain the abductive loss; S8. Correct the recommendation results by minimizing the backpropagation of the abductive loss; S9. Reorder the candidate cloud APIs from large to small according to the corrected complementary scores.

2. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S1, specifically including: query set Q Each query in the Cloud API is converted into a corresponding probability embedding vector: ; in, PEU is a probabilistic embedding unit; E ( q i ) to query the cloud API q i The corresponding Beta probability embedding vector; the Beta probability embedding vector is given by and Two parameters determine; each query cloud API contains d Hidden features, query cloud API q i No. k The latent features are distributed by Beta express.

3. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S2, the following steps are specifically included: S2.1、Design in relational constraints r The projection operator under PJ r , as shown below: ; Among them, the relationship constraint r Including substitute constraints sc and common call constraints cc ; MLP is a multi-layer perceptron; E ( r ) is a relational constraint r The corresponding Beta probability embedding vector; E ( q i ) to query the cloud API q i The corresponding Beta probability embedding vector; After the projection operator PJ r Available query cloud API in relational constraints r The embedding vector under S2.

2. Design of negation operator NG , as shown below: ; in, E ( q i ) NG is the inverted embedding vector; S2.

3. Design of Intersection and Union Operators IS , as shown below: ; in, E ( q ) IS is the embedding vector obtained after applying the intersection operator; S2.4, Logical reasoning of complementary relations: First, query the Cloud API for each q The corresponding embedding vector E ( q ) is carried out in the substitute constraint sc The projection under the ,gets the embedding vector with the substitute relationship with the query cloud API, and then performs the common call constraint cc The projection under ; at this time, the embedding vector with a weak complementary relationship with the query cloud API is obtained , as shown below: ; Since any cloud API is its own replacement, It also takes into account the strong complementary relationship; S2.5, Non-substitute relational logical reasoning: First, query the Cloud API for each q The corresponding embedding vector E ( q ) is carried out in the substitute constraint sc The projection under , get the embedding vector with a substitute relationship with the query cloud API; then use the inversion operator to get the embedding vector E ( q ) sc-NG , thereby eliminating the influence of substitute noise, as shown in the following formula: ; S2.

6. Apply the intersection operator to obtain the query cloud API q The complementary embedding vector of , as shown below: ; Through the reasoning of S2.4, S2.5, and S2.6, a logical reasoning unit is obtained that takes into account the strong and weak complementary relationships and eliminates the influence of substitute noise.

4. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S5, specifically including: sorting candidate cloud APIs from large to small according to the complementary scores to obtain a complementary recommendation list CRL , as shown below: ; in, c i After sorting i candidate cloud APIs; for c i The corresponding complementary scores.

5. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S6, the following steps are specifically included: S6.

1. Because the recommendation results are generated by the query set, any query cloud API in the query set can be used as the actual reason for generating the recommendation result. q t , as shown below: ; in, Sample Random sampling was used; S6.2, in order to prevent the introduction of too much irrelevant information and thus cause overcorrection, only select CRL Center front K AC The candidate cloud APIs are used as the objects of tracing and correction, as shown in the following formula: ; in, L It is the input of the tracing task and the list of candidate cloud APIs that need to be corrected; S6.

3. To characterize the importance of different candidate cloud APIs, the complementary scores corresponding to the candidate cloud APIs are converted into weights as shown in the following formula: ; in, Candidate Cloud API The corresponding weight; is the sigmoid activation function; It is a hyperparameter and its value is greater than 0 and is used to smooth the complementary score after activation; S6.

4. Generate a comprehensive cloud API using the obtained weights , as shown below: ; Comprehensive cloud API represents the recommendation result generated in step S5; S6.

5. Using Abductive Models f AM Infer the reasons that are most likely to complement the recommended results , as shown below: ; Abductive Model f AM It has the same structure as the method adopted in the complementary recommendation stage; The larger the value, the more inferred the reason. The real reason q t The smaller the difference between them.

6. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S7, specifically including: using inferred reasons And the real reason q t The difference between the two gets the abductive loss Aloss , as shown below: ; in, is the sigmoid activation function; Representative inferred reason And the real reason q t The difference between.

7. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S8, it specifically includes: minimizing the back propagation of the abductive loss to correct the recommendation result, as shown in the following formula: ; in, Candidate Cloud API c j The corresponding complementary scores, and .

8. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S9, the specific steps include: re-ranking the candidate cloud APIs from largest to smallest according to the corrected complementary scores, as shown in the following formula: ; in, This is the complementary recommendation list after reordering.

Citation Information

Patent Citations

  • API (Application Program Interface) recommendation method based on prompt learning and dual-information source fusion

    CN117034135A

  • Function label driven LDA-based cloud API complementary recommendation method

    CN117215677A