Cloud API complementary recommendation method based on logical reasoning and tracing factor correction
Through the method based on logical reasoning and tracing correction, the problem of existing cloud API recommendation methods ignoring complementary relationships and not correcting is solved, and more accurate cloud API recommendations and better service-based software development support are achieved.
Patent Information
- Application Number
- CN202411960969.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The existing cloud API recommendation method ignores the developers' needs for complementary cloud APIs, and fails to effectively model weak complementary relationships and eliminate the impact of substitute noise, and the recommendation results are not corrected.
The complementary recommendation method of cloud API based on logical reasoning and tracing correction is adopted. By converting the query cloud API into a probability embedding vector, the complementary embedding vector is obtained using the logical reasoning unit, the complementary score is calculated based on the attention network and KL divergence, and the recommendation result is corrected through the tracing model.
The complementary relationship of cloud APIs is effectively modeled, the impact of substitute noise is eliminated, and the accuracy of recommendations is improved by correcting the recommendation results, meeting developers' needs for complementary cloud APIs.
Smart Images

Figure CN119903085A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent software engineering, and in particular to a cloud API complementary recommendation method based on logical reasoning and abductive correction. Background Art
[0002] In the cloud era, cloud APIs are the best carriers for service delivery, data exchange, and capability replication. The exponential growth of cloud APIs in dynamic open networks provides developers with more choices, but it also overwhelms them with a massive amount of cloud APIs. Therefore, designing an effective cloud API recommendation method is crucial for the healthy development of the cloud API economy. Existing cloud API recommendation methods mainly recommend cloud APIs with similar preferences, single functions, and high quality to developers from three perspectives: historical interaction on the user side, content matching on the functional side, and service quality perception on the non-functional side.
[0003] However, existing cloud API recommendation methods ignore developers' needs for complementary cloud APIs. Existing complementary relationship modeling methods often model strong complementary relationships from the perspective of common calls, but ignore the modeling of weak complementary relationships from the perspective of function co-occurrence, and fail to effectively eliminate the impact of substitute noise. In addition, existing cloud API recommendation methods generate recommendation results in one step, without considering correcting the recommendation results to further improve the recommendation effect. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a cloud API complementarity recommendation method based on logical reasoning and abductive correction, which can effectively model the complementary relationship and correct the recommendation results, provide users with more accurate cloud API recommendations, and effectively meet the objective needs of developers for complementary cloud APIs in the process of service-oriented software development.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0006] A cloud API complementary recommendation method based on logical reasoning and abductive correction includes the following steps:
[0007] S1, convert the query cloud API into the corresponding probabilistic embedding vector;
[0008] S2, using the logical reasoning unit to obtain the complementary embedding vector corresponding to each query cloud API;
[0009] S3, using the attention network to obtain complementary basis vectors that are complementary to the query set as a whole;
[0010] S4, using the KL divergence between the complementary basis vectors and the candidate cloud APIs to obtain the complementary score;
[0011] S5. Sort the candidate cloud APIs according to the complementary scores from large to small to obtain a complementary recommendation list;
[0012] S6. Use the abductive model to infer the reasons that are most likely to complement the recommended results;
[0013] S7, using the difference between the inferred cause and the real cause to obtain the abductive loss;
[0014] S8, correct the recommendation results by minimizing the back propagation of the abductive loss;
[0015] S9. Reorder the candidate cloud APIs from large to small according to the corrected complementary scores.
[0016] A further improvement of the technical solution of the present invention is that: in S1, it specifically includes: 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] Among them, PEU is the probability embedding unit; E(q i ) is to query the 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.
[0020] A further improvement of the technical solution of the present invention is that in S2, the following steps are specifically included:
[0021] S2.1. Design of projection operator PJ under relational constraint r r , as shown below:
[0022] PJ r (E(q i ))=MLP(concat(E(r),E(q i )))
[0023] Among them, the relation constraint r includes the substitute constraint sc and the common call constraint cc; MLP is a multi-layer perceptron; E(r) is the Beta probability embedding vector corresponding to the relation constraint r; E(q i ) is to query the cloud API q i The corresponding Beta probability embedding vector;
[0024] After the projection operator PJ r The embedding vector of the query cloud API under the relation constraint r can be obtained;
[0025] S2.2. Design the negation operator NG, as shown below:
[0026] NG(E(q i ))=E(q i ) NG
[0027] Among them, E(q i ) NG is the inverted embedding vector;
[0028] S2.3, design the intersection operator IS, as shown below:
[0029] IS(E(q1),...,E(q n ))=E(q) IS
[0030] Among them, E(q) IS is the embedding vector obtained after applying the intersection operator;
[0031] S2.4, Logical reasoning of complementary relationship:
[0032] First, the embedding vector E(q) corresponding to each query cloud API q is projected under the substitute constraint sc to obtain the embedding vector with a substitute relationship with the query cloud API, and then projected under the common call constraint cc; at this time, the embedding vector E(q) with a weak complementary relationship with the query cloud API is obtained. sc-cc , as shown below:
[0033] E(q) sc-cc =PJ cc (PJ sc (E(q)))
[0034] Since any cloud API is a substitute for itself, E(q) sc-cc It also takes into account the strong complementary relationship;
[0035] S2.5, non-substitute relationship logical reasoning:
[0036] First, the embedding vector E(q) corresponding to each query cloud API q is projected under the substitute constraint sc to obtain the embedding vector with a substitute relationship with the query cloud API; then the inversion operator is used to obtain the embedding vector E(q) sc-NG , thereby eliminating the influence of substitute noise, as shown in the following formula:
[0037] E(q) sc-NG =NG(PJ sc (E(q)))
[0038] S2.6. Apply the intersection operator to obtain the complementary embedding vector E(q) of the query cloud API q IS , as shown below:
[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, a logical reasoning unit is obtained that takes into account the strong and weak complementary relationships and eliminates the influence of substitute noise.
[0041] A further improvement of the technical solution of the present invention is that in S3, specifically including: using the attention network Att to obtain a complementary basis vector E(Q) that is complementary to the query set Q as a whole base , as shown below:
[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 in generating recommendation results, and the recommended candidate cloud APIs are required to be complementary to the query set as a whole.
[0044] A further improvement of the technical solution of the present invention is that: in S4, specifically including: using the complementary basis vector E(Q) base The KL divergence between the embedding vector E(c) of the candidate cloud API c and the complementary score y is obtained as shown in the following formula:
[0045]
[0046] Among them, ε 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 E(Q) base The probability density function corresponding to the jth latent feature; p j(x) is the probability density function corresponding to the jth latent feature of E(c); KL divergence can measure the distance between two probability distribution functions;
[0047] E(Q) base The smaller the distance between the latent features and E(c), the higher the degree of complementarity between the query set and the candidate cloud APIs, that is, the larger the complementarity score.
[0048] A further improvement of the technical solution of the present invention is that: in S5, it specifically includes: sorting the candidate cloud APIs from large to small according to the complementary scores to obtain a complementary recommendation list CRL, as shown in the following formula:
[0049]
[0050] Among them, c i is the i-th candidate cloud API after sorting; c i The corresponding complementary scores.
[0051] A further improvement of the technical solution of the present invention is that in S6, the following steps are specifically included:
[0052] 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 real reason for generating the recommendation result. t , as shown below:
[0053] Sample(Q)=q t
[0054] Among them, Sample uses random sampling;
[0055] S6.2. In order to prevent the introduction of too much irrelevant information and thus cause over-correction, only the first K in the CRL are selected. AC The candidate cloud APIs are used as the objects of tracing and correction, as shown in the following formula:
[0056]
[0057] Among them, L is the input of the tracing task and the list of candidate cloud APIs that need to be corrected;
[0058] S6.3. In order 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:
[0059]
[0060] in, Candidate Cloud APIc jThe corresponding weights; σ is the sigmoid activation function; γ is a hyperparameter and its value is greater than 0 for smoothing the complementary score after activation;
[0061] S6.4. Generate a comprehensive cloud API using the obtained weights As shown below:
[0062]
[0063] Comprehensive cloud API represents the recommendation result generated in step S5;
[0064] S6.5. Using the Abductive Model AM Infer the reasons that are most likely to complement the recommended results As shown below:
[0065]
[0066] Abductive Model AM The method has the same structure as that used in the complementary recommendation phase; qt The larger the value, the more likely it is to be inferred. The real reason t The smaller the difference between them.
[0067] A further improvement of the technical solution of the present invention is that in S7, specifically including: using the inferred cause And the real reason t The difference between them is the abductive loss Aloss, as shown in the following formula:
[0068]
[0069] Among them, σ is the sigmoid activation function; Representative inference reason And the real reason t The difference between.
[0070] A further improvement of the technical solution of the present invention is that in S8, it specifically includes: correcting the recommendation result by minimizing the back propagation of the abductive loss, as shown in the following formula:
[0071]
[0072] in, Candidate Cloud API c j The corresponding complementary scores, and c j ∈L.
[0073] A further improvement of the technical solution of the present invention is that in S9, it specifically includes: re-ordering the candidate cloud APIs from large to small according to the corrected complementary scores, as shown in the following formula:
[0074] CRL′=rank(L)
[0075] Among them, CRL′ is the complementary recommendation list after reordering.
[0076] Due to the adoption of the above technical solution, the technical progress achieved by the present invention is:
[0077] 1. The present invention converts each query cloud API into a corresponding probabilistic embedding vector; obtains the complementary embedding vector corresponding to each query cloud API through a logical reasoning unit; uses an attention network to obtain a complementary basis vector that is complementary to the query set as a whole; uses the KL divergence between the complementary basis vector and the candidate cloud API to obtain a complementary score; generates a complementary recommendation list by sorting the complementary scores from large to small; uses an abductive model to infer the reasons that are most likely to be complementary to the recommended results; uses the difference between the inferred reasons and the true reasons to obtain the abductive loss; minimizes the back propagation of the abductive loss to correct the recommendation results; reorders the corrected candidate cloud APIs from large to small; compared with most methods, it recommends services in the dimension of cloud API complementarity, which can meet the actual needs of developers for complementary cloud API recommendations.
[0078] 2. The present invention utilizes a logical reasoning unit in combination with cloud API co-calling and function co-occurrence to model the complementary relationship, and can effectively eliminate the impact of substitute noise.
[0079] 3. Unlike traditional solutions that cannot correct recommendation results, the cloud API complementary recommendation method based on logical reasoning and abductive correction provided by the present invention can correct recommendation results through abductive correction, thereby further improving the recommendation effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
[0081] Figure 1 It is a flow chart of a cloud API complementary recommendation method based on logical reasoning and abductive correction provided in an embodiment of the present invention;
[0082] Figure 2 is a schematic diagram of a cloud API complementary recommendation method based on logical reasoning and abductive correction provided in an embodiment of the present invention;
[0083] Figure 3 It 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 inherent to these processes, methods, products or apparatus.
[0085] The present invention is further described in detail below with reference to the accompanying drawings and embodiments:
[0086] like Figure 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 probabilistic 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 to query the 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, using the logical reasoning unit to obtain the complementary embedding vector corresponding to each query cloud API;
[0093] The specific steps include:
[0094] S2.1. Design of projection operator PJ under relational constraint r r , as shown below:
[0095] PJ r (E(q i ))=MLP(concat(E(r),E(q i )))
[0096] Among them, the relation constraint r includes the substitute constraint sc and the common call constraint cc. MLP is a multi-layer perceptron, and E(r) is the Beta probability embedding vector corresponding to the relation constraint r. After the projection operator PJ r The embedding vector of the query cloud API under the relation constraint r can be obtained.
[0097] S2.2. Design the negation operator NG, as shown below:
[0098] NG(E(q i ))=NG((α i ,β i ))=[α i NG ,β i NG ]
[0099] Among them, α i NG =1 / α i , β i NG =1 / β i .
[0100] S2.3, design the intersection operator IS, as shown below:
[0101]
[0102] in,
[0103] S2.4, Logical reasoning of complementary relationship:
[0104] First, the embedding vector E(q) corresponding to each query cloud API q is projected under the substitute constraint sc to obtain the embedding vector with a substitute relationship with the query cloud API, and then projected under the common call constraint cc. At this time, the embedding vector E(q) with a weak complementary relationship with the query cloud API can be obtained. sc-cc , as shown below:
[0105] E(q) sc-cc =PJ cc (PJ sc (E(q)))
[0106] Since any cloud API is a substitute for itself, E(q) sc-cc It also takes into account the strong complementary relationship.
[0107] S2.5, non-substitute relationship logical reasoning:
[0108] First, the embedding vector E(q) corresponding to each query cloud API q is projected under the substitute constraint sc to obtain the embedding vector that has a substitute relationship with the query cloud API. Then, the inversion operator is used to obtain the embedding vector E(q) sc-NG , thereby eliminating the influence of substitute noise, as shown in the following formula:
[0109] E(q) sc-NG =NG(PJ sc (E(q)))
[0110] S2.6. Apply the intersection operator to obtain the complementary embedding vector E(q) of the query cloud API q IS , as shown below:
[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, we can obtain a logical reasoning unit that takes into account the strong and weak complementary relationships and eliminates the influence of substitute noise.
[0113] S3. Use the attention network Att to obtain the complementary basis vector E(Q) that is complementary to the query set Q as a whole base , as shown below:
[0114] E(Q) base =Att({E(q1),...E(q t ),...E(q T )})=[α base ,β base ]
[0115] in,
[0116] The attention network is adopted 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.
[0117] S4. Using complementary basis vectors E(Q)base The KL divergence between the embedding vector E(c) of the candidate cloud API c and the complementary score y is obtained as shown in the following formula:
[0118]
[0119] Among them, ε is a hyperparameter and its value is greater than 0, q j (x) is E(Q) base The probability density function corresponding to the jth latent feature, p 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, E(Q) base The smaller the distance between the latent features and E(c), the higher the degree of complementarity between the query set and the candidate cloud APIs, that is, the larger the complementarity score.
[0120] S5. Sort the candidate cloud APIs according to the complementary scores from large to small to obtain the complementary recommendation list CRL, as shown in the following formula:
[0121]
[0122] Among them, c i is the i-th candidate cloud API after sorting; c i The corresponding complementary scores.
[0123] S6. Use the abductive model to infer the reasons that are most likely to complement the recommended results;
[0124] The specific steps include:
[0125] 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 real reason for generating the recommendation result. t , as shown below:
[0126] Sample(Q)=q t
[0127] Among them, Sample uses random sampling.
[0128] S6.2. In order to prevent the introduction of too much irrelevant information and thus cause over-correction, only the first K in the CRL are selected. AC The candidate cloud APIs are used as the objects of tracing and correction, as shown in the following formula:
[0129]
[0130] Among them, L is the input of the tracing task and the list of candidate cloud APIs that need to be corrected.
[0131] S6.3. In order 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:
[0132]
[0133] in, Candidate Cloud APIc j The corresponding weights, σ is the sigmoid activation function, and γ is a hyperparameter whose value is greater than 0 and is used to smooth the complementary score after activation.
[0134] S6.4. Generate a comprehensive cloud API using the obtained weights As shown below:
[0135]
[0136] Comprehensive cloud API Represents the recommendation result generated in step S5.
[0137] S6.5. Using the Abductive Model AM Infer the reasons that are most likely to complement the recommended results As shown below:
[0138]
[0139] For simplicity, the abductive model f AM It has the same structure as the method adopted in the complementary recommendation stage (complementary recommendation model). The larger the value, the more likely it is to be inferred. The real reason t The smaller the difference between them.
[0140] S7. Use inferred reasons And the real reason t The difference between them is the abductive loss Aloss, as shown in the following formula:
[0141] Aloss=-log(σ(y qt ))
[0142] Among them, σ is the sigmoid activation function; y qt Representative inference reason And the real reason t The difference between.
[0143] S8. Minimize the back propagation of the abductive loss to correct the recommendation result, as shown in the following formula:
[0144]
[0145] in, Candidate Cloud API c j The corresponding complementary scores, and c j ∈L.
[0146] S9. Re-rank the candidate cloud APIs from large to small according to the corrected complementary scores, as shown in the following formula:
[0147] CRL′=rank(L)
[0148] Among them, CRL′ is the complementary recommendation list after reordering.
[0149] In summary, the present invention converts each query cloud API into a corresponding Beta probability embedding vector; obtains the complementary embedding vector corresponding to each query cloud API through a logical reasoning unit; uses an attention network to obtain a complementary basis vector that is complementary to the query set as a whole; uses the KL divergence between the complementary basis vector and the candidate cloud API to obtain a complementary score; generates a complementary recommendation list by sorting the complementary score from large to small; uses an abductive model to infer the most likely reason to be complementary to the recommended result; uses the difference between the inferred reason and the true reason to obtain the abductive loss; minimizes the abductive loss to correct the recommendation result by back propagation; and reorders the corrected candidate cloud APIs from large to small. This method provides users with more accurate cloud API recommendations, effectively meeting the objective needs of developers for complementary cloud APIs in the process of service-oriented software development.
[0150] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
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 probabilistic embedding vector; S2, using the logical reasoning unit to obtain the complementary embedding vector corresponding to each query cloud API; S3, using the attention network to obtain complementary basis vectors that are complementary to the query set as a whole; S4, using the KL divergence between the complementary basis vectors and the candidate cloud APIs to obtain the complementary score; S5. Sort the candidate cloud APIs according to the complementary scores from large to small 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 real cause to obtain the abductive loss; S8, correct the recommendation results by minimizing the back propagation 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, characterized in that: In S1, it specifically includes: converting each query cloud API in the query set Q into a corresponding probability embedding vector: LITTLE(q i )=E(q i ) And(q i )=([and αi_1 ,And αi_2 ,...,And αi_d ],[And βi_1 ,And βi_2 ,...,And βi_d ])=[α i ,β i ] Among them, PEU is the probability embedding unit; E(q i ) is to query the 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.
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 of projection operator PJ under relational constraint r r , as shown below: PJ r (E(q i ))=MLP(concat(E(r),E(q i ))) Among them, the relation constraint r includes the substitute constraint sc and the common call constraint cc; MLP is a multi-layer perceptron; E(r) is the Beta probability embedding vector corresponding to the relation constraint r; E(q i ) is to query the cloud API q i The corresponding Beta probability embedding vector; After the projection operator PJ r The embedding vector of the query cloud API under the relation constraint r can be obtained; S2.
2. Design the negation operator NG, as shown below: OF(E(q i ))=E(q i ) NG Among them, E(q i ) NG is the inverted embedding vector; S2.3, design the intersection operator IS, as shown below: IS(E(q1),...,E(q n ))=E(q) IS Among them, E(q) IS is the embedding vector obtained after applying the intersection operator; S2.4, Logical reasoning of complementary relationship: First, the embedding vector E(q) corresponding to each query cloud API q is projected under the substitute constraint sc to obtain the embedding vector with a substitute relationship with the query cloud API, and then projected under the common call constraint cc; at this time, the embedding vector E(q) with a weak complementary relationship with the query cloud API is obtained. sc-cc , as shown below: And(q) sc-cc =PJ cc (PJ sc (E(q))) Since any cloud API is a substitute for itself, E(q) sc-cc It also takes into account the strong complementary relationship; S2.5, non-substitute relationship logical reasoning: First, the embedding vector E(q) corresponding to each query cloud API q is projected under the substitute constraint sc to obtain the embedding vector with a substitute relationship with the query cloud API; then the inversion operator is used to obtain the embedding vector E(q) sc-NG , thereby eliminating the influence of substitute noise, as shown in the following formula: E(q) sc-NG =NG(PJ sc (E(q))) S2.
6. Apply the intersection operator to obtain the complementary embedding vector E(q) of the query cloud API q IS , as shown below: E(q) IS =IS(E(q) sc-cc ,E(q) sc-NG ) 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, characterized in that: In S3, it specifically includes: using the attention network Att to obtain the complementary basis vector E(Q) that is complementary to the query set Q as a whole base , as shown below: E(Q) base =That({E(q1),...E(q t ),...E(q T )}) The attention network is adopted 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.
5. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S4, specifically including: using complementary basis vectors E(Q) base The KL divergence between the embedding vector E(c) of the candidate cloud API c and the complementary score y is obtained as shown in the following formula: Among them, ε 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 E(Q) base The probability density function corresponding to the jth latent feature; p j (x) is the probability density function corresponding to the jth latent feature of E(c); KL divergence can measure the distance between two probability distribution functions; E(Q) base The smaller the distance between the latent features and E(c), the higher the degree of complementarity between the query set and the candidate cloud APIs, that is, the larger the complementarity score.
6. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1 is characterized by: In S5, specifically, the following steps are performed: sorting the candidate cloud APIs according to the complementary scores from large to small to obtain a complementary recommendation list CRL, as shown in the following formula: Among them, c i is the i-th candidate cloud API after sorting; c i The corresponding complementary scores.
7. 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 real reason for generating the recommendation result. t , as shown below: Sample(Q)=q t Among them, Sample uses random sampling; S6.
2. In order to prevent the introduction of too much irrelevant information and thus cause over-correction, only the first K in the CRL are selected. AC The candidate cloud APIs are used as the objects of tracing and correction, as shown in the following formula: Among them, L is the input of the tracing task and the list of candidate cloud APIs that need to be corrected; S6.
3. In order 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 APIc j The corresponding weights; σ is the sigmoid activation function; γ is a hyperparameter and its value is greater than 0 for smoothing 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 the Abductive Model AM Infer the reasons that are most likely to complement the recommended results As shown below: Abductive Model AM The approach used in the complementary recommendation phase has the same structure; The larger the value, the more likely it is to be inferred. The real reason t The smaller the difference between them.
8. 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 causes And the real reason t The difference between them is the abductive loss Aloss, as shown in the following formula: Among them, σ is the sigmoid activation function; Representative inference reason And the real reason t The difference between.
9. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1, characterized in that: 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 c j ∈L.
10. The cloud API complementary recommendation method based on logical reasoning and abductive correction according to claim 1, characterized in that: In S9, specifically, the following steps are performed: re-ranking the candidate cloud APIs from large to small according to the corrected complementary scores, as shown in the following formula: CRL′=rank(L) Among them, CRL′ 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
Web API recommendation method and system based on multi-modal feature fusion
CN117493697A
Tracking factor correction method applied to cloud API (Application Program Interface) high-order complementary recommendation
CN118409967A
Dress collocation method and system based on attention knowledge extraction, and storage medium
WO2019223302A1