Data service recommendation method fusing bi-scale contrast learning and multi-objective optimization

By constructing a multi-channel hypergraph convolutional network and a dual-scale contrastive learning method, the problem that existing Web API recommendation methods cannot effectively capture collaborative signals in complex business scenarios is solved, thereby improving recommendation accuracy and robustness and adapting to complex data scenarios.

CN119760218BActive Publication Date: 2025-11-11CHINA JILIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411681858.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-11-11
Estimated Expiration
2044-11-22

AI Technical Summary

Technical Problem

Existing Web API recommendation methods cannot effectively capture collaborative signals in Mashup-API call relationships when dealing with complex business scenarios. Furthermore, their reliance on labeled data leads to insufficient model robustness, severe overfitting, and difficulty in generalizing to new data.

Method used

We employ a method that integrates dual-scale contrastive learning and multi-objective optimization. By constructing a multi-channel hypergraph convolutional network and utilizing structures such as co-associative motifs, we optimize the convolutional weight matrix using a hybrid random walk algorithm. Furthermore, we enhance the accuracy and robustness of the recommendation model through channel attention mechanisms and dual-scale contrastive learning.

Benefits of technology

It improves the accuracy and efficiency of Web API recommendations, reduces the impact of noise, enhances the model's generalization ability and robustness, and adapts to complex data scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760218B_ABST
    Figure CN119760218B_ABST
Patent Text Reader

Abstract

A data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization is proposed. First, a hypergraph structure is extracted from the services using a motif to study the complex relationships between service data. To reduce the impact of noise, a convolution weight matrix is ​​introduced during the hypergraph convolution process, and convolution operations are performed on the constructed hypergraph based on this weight matrix and a hybrid random walk. Further, a channel attention mechanism is used to merge the convolution results from different channels, and a dual-scale contrastive learning method is employed to maximize the information obtained by the recommendation model. Finally, a multi-objective model is used to optimize the recommendation results. This invention improves the performance of Web API recommendations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to service recommendation scenarios in Mashup development, specifically to a Web API recommendation method based on a multi-channel hypergraph convolutional network. Background Technology

[0002] Services have a wide range of applications, from performing simple arithmetic operations to handling complex programming tasks in distributed networks. With the help of standardized description languages, such as the Web Services Description Language (WSDL), services can expose their interfaces, facilitating service discovery and utilization. Furthermore, services can be invoked via Simple Object Access Protocol (SOAP) or Representational State Transfer (REST) ​​protocols, enabling service reuse. Service-Oriented Architecture (SOA), as a new system architecture, provides organizations with greater flexibility and agility in addressing challenges such as Internet applications. This architectural style provides a framework at the technical level where the software structure is broken down into units provided by service providers (such as Web APIs), and each unit must meet specific conditions, such as independence, reusability, and identifiability, and be able to interact through independent messaging mechanisms. These services are collectively referred to as Web services.

[0003] Faced with the rapid development of the information society and the emergence of numerous additional demands, existing Web API functionalities are insufficient to handle increasingly complex business scenarios. To fill this gap, Mashup technology emerged. The core concept of Mashup is to use Web APIs as reusable components to create new products or solutions. By integrating multiple services to match customized user needs, it significantly lowers the development threshold, enabling even developers lacking programming skills to quickly build applications using readily available APIs and shortening development cycles. Furthermore, Mashup not only promotes service reuse but has also spurred the development of numerous Mashup application platforms launched by internet companies such as Microsoft and IBM.

[0004] With the increasing number of services, service recommendation technology has become a focus of research. Existing research primarily focuses on the descriptive documents or call relationship data of services, extracting service features through in-depth analysis to achieve recommendations. Current research often emphasizes analyzing service description documents and other carried information (Quality of Service (QoS) parameters, tags, historical information) to extract features and recommend matching services. For example, Ramathulasi et al. proposed the DAT-LDA model to obtain the topic probability distribution of Mashup service documents, thereby achieving service clustering. Ren et al. constructed the service composition problem as a Markov decision process and incorporated the service's carrying information. This method significantly improves adaptability to the uncertain behavior of services in dynamic environments and solves the user's QoS constraints. However, the effectiveness of these methods largely depends on the accuracy and completeness of the information provided by the services. Insufficient information detail will directly affect the recommendation effect. The functional interaction information between Mashups and Web APIs has also been a focus of academic research. Rahman et al. used two-layer topic modeling to process the interaction data between Mashups, thereby constructing a denser Mashup-Web API dataset. They then applied regularized matrix factorization to the embedding process of Mashups and Web APIs to generate an effective Web API recommendation list. Although these methods have made progress in improving the performance of recommendation systems, existing research has not yet adequately encoded the collaborative signals in Mashup-API call relationships into the embedding vectors, resulting in the generated embeddings being insufficient to capture these collaborative signals.

[0005] Driven by both deep neural networks and theoretical analysis, machine learning has achieved leaps and bounds in many fields. Despite these significant achievements, the heavy reliance on labeled data has also exposed some limitations. First, manually collecting and annotating labels is extremely costly, especially when dealing with large-scale datasets or domain-specific knowledge. Second, standard supervised learning often fails to generalize well to new data due to overfitting, which is particularly pronounced when training data is scarce. Third, supervised learning models are vulnerable to adversarial attacks that manipulate labels, leading to insufficient robustness.

[0006] Inspired by recent advances in contrastive learning in computer vision and natural language processing, several studies have proposed applying it to service data. The design of contrastive learning for service data can be summarized into three main modules: Data Augmentation, which transforms or expands the original data to increase its diversity and capacity; Pretext Tasks, auxiliary tasks within the contrastive learning framework aimed at creating informative contrastive sample pairs; and Contrastive Objectives, a set of objective functions used to measure the consistency of sample pairs, which are the core components of contrastive learning. Summary of the Invention

[0007] To overcome the shortcomings of existing technologies and address the characteristics of sparse service data and complex business scenarios, this invention proposes a data service recommendation method that integrates dual-scale contrastive learning and multi-objective optimization. First, a hypergraph structure is extracted from the services using a motif to study the complex relationships between service data. To reduce the impact of noise, a convolution weight matrix is ​​introduced during the hypergraph convolution process, and convolution operations are performed on the constructed hypergraph based on this weight matrix and a hybrid random walk. Furthermore, a channel attention mechanism is employed to merge the convolution results from different channels, and a dual-scale contrastive learning method is used to maximize the information obtained by the recommendation model. Finally, a multi-objective model is used to optimize the recommendation results, improving the performance of Web API recommendations.

[0008] This invention provides the following technical solution:

[0009] A data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization, the method comprising the following steps:

[0010] The first step is to extract the service hypergraph based on the service motif, as follows:

[0011] Step (1.1) Crawl Mashup service information from relevant API websites;

[0012] Step (1.2) analyzes the crawled Mashup service set and selects metadata that is beneficial to improving the accuracy of service recommendations and is rich in content;

[0013] Step (1.3) summarizes four types of motifs: co-associative motifs, multiple strongly associated motifs, single relation motifs, and composite relation motifs;

[0014] Step (1.4) Construct a multi-channel hypergraph based on the phantom proposed in step (1.3);

[0015] The second step is to calculate the convolution weight matrix C of the multi-channel hypergraph using a hybrid random walk algorithm, as follows:

[0016] Step (2.1) proposes a hybrid random walk algorithm based on combining partially absorbed random walk and biased random walk, and calculates the convolution weight matrix C on the hypergraph;

[0017] Step (2.2) Based on the weight calculation formula, we further obtain Λ(CI)+CD=(W⊙Q)C, where Λ is a regularization matrix with all values ​​greater than 0, D represents the degree matrix of the hypergraph, which is a diagonal matrix whose diagonal elements represent the degree of the corresponding vertex; W represents the weight between nodes determined by the degree, and Q is the parameter matrix used to adjust the transition probability in a biased random walk;

[0018] Step (2.3) further calculates and derives the closed-form of the convolution weight matrix: C = (Λ + L). -1 Λ; where L = DW⊙Q;

[0019] The third step is to perform convolution operations on the hypergraph and aggregate the convolution results on multiple channels to obtain the Mashup embedding representation.

[0020] Step 4: Based on the channel error attention mechanism and the output of each channel, the process is as follows:

[0021] Step (4.1) uses a channel error attention mechanism to calculate the weight of each channel;

[0022] Step (4.2) aggregates the outputs of each channel according to their weights to obtain a complete representation of the hypergraph vertices;

[0023] Step 5: Perform convolution on the Mashup-API call graph to obtain the embedded representation of the API;

[0024] Step 6: Propose a dual-scale contrastive learning method to maximize the consistency between the same node and the differences between different nodes obtained through two different approaches, thereby enabling the recommendation model to obtain more information.

[0025] Step 7: Optimize the model based on the recommendation results.

[0026] Furthermore, in step (1.2), the retained metadata includes Mashup, API, the calling relationship between Mashup and API, and the tags carried by Mashup;

[0027] The Mashup set is defined as M = {m1, m2, ..., m}. N}, where N is the total number of Mashups in the set, and m is the number of Mashups. iThe API set called is A i ={a i,1 ,a i,2 ,a i,3 ,…,a i,k}, k is Mashup m i The total number of APIs called, and the set of APIs called by all Mashups. Where ∪ represents finding the union of all sets, and the Mashup-API call relationships are stored in a 0-1 matrix. middle, Represents the set of real numbers. Let A be a matrix of size N×|A| consisting of real numbers, where |A| represents the number of elements in set A, and each pair of Mashup m and API a,t is involved. m,a =1 indicates that Mashup m and API a have a calling relationship, t m,a =0 indicates that Mashup m and API a do not have a calling relationship;

[0028] In this invention, labels represent some functions or attributes of the Mashup, and the label information includes collaboration information between the Mashup and its API. Therefore, the feature mining process for both the API and the Mashup utilizes not only call information but also label information. This invention uses a 0-1 matrix. This represents the carrying relationship between tags and Mashups. Specifically, for each pair of Mashups m and tags ta, R... m,ta =1 indicates that there is a carry relationship between Mashup m and label ta, R m,ta =0 indicates that Mashup m and label ta have no carrying relationship.

[0029] Furthermore, in step (1.3), the motif represents the connection patterns that appear repeatedly in the network, and the number of these connection patterns is significantly higher than that of other complex networks. These connection patterns often contain key information about the network, and numerous studies have demonstrated that motifs have the substantial ability to bridge the gap between microscopic and macroscopic structural information.

[0030] The four types of phantoms are described in detail below:

[0031] Shared-label motifs: In Mashup invocation scenarios, if two Mashups carry the same label, this invention refers to this as a shared-label relationship. In service data, if Mashups have pairwise shared-label relationships and form a ternary closure structure, this is called a shared-label motif.

[0032] The triplet closure is a concept in social network theory, which refers to a property of a triplet consisting of three nodes A, B, and C, namely, that there are strong connections between A and B, A and C, and B and C.

[0033] Multiple strongly associated motifs: The diversity of tags and the artificial definition of tags cause uncertainty in the tags carried by Mashups. This invention defines the relationship between a pair of Mashups carrying two or more identical tags as a strong association relationship, and defines the structure of multiple Mashups forming a closed loop with strong association relationships as a multiple strongly associated motif.

[0034] Single Relationship Module: The calling relationship between a Mashup and its API reflects the functional characteristics of the Mashup. Two Mashups that call the same API have similar functions. This invention defines a module in which two Mashups call the same API as a single relationship module.

[0035] Composite relational motif: Mashups that call the same API and carry the same label. In order to explore the relationship between Mashups using this feature, this invention defines Mashups that call the same API and have the same label relationship as composite relational motifs.

[0036] Furthermore, the process of step (1.4) is as follows:

[0037] Step (1.4.1) constructs the hypergraph G1 based on the "co-associative motifs", as follows:

[0038] Step (1.4.1.1) calculates the relation matrix R based on the Mashup-label carried relation matrix. Proceed to step (1.4.1.2);

[0039] in, This indicates that the Mashups carry the same number of tags. The "" indicates the transpose of the matrix.

[0040] Step (1.4.1.2) Construct the upper triangular matrix R * This is used to indicate whether Mashups carry the same tag, and to proceed to step (1.4.1.3);

[0041] Among them, R * From the matrix Take the top right corner of the diagonal and set all numbers greater than 0 to 1;

[0042] Step (1.4.1.3) calculates the adjacency matrix of the hypergraph G1;

[0043] The adjacency matrix is ​​a matrix that represents the adjacency relationships between vertices in a hypergraph. The adjacency matrix S1 of hypergraph G1 is calculated as S1 = (R... * R * )⊙R * , where ⊙ denotes the Hadamard product of the matrices on the left and right sides;

[0044] Step (1.4.2) constructs the hypergraph G2 based on the "multiple strongly correlated motifs", as follows:

[0045] Step (1.4.2.1) Construct matrix R ′ This is used to indicate whether Mashups carry two or more identical tags, and to proceed to step (1.4.2.2).

[0046] Where, matrix R′ is obtained by taking the matrix The upper triangular matrix is ​​constructed by setting all numbers greater than 2 to 1 and the rest to 0 in the upper right corner of the diagonal.

[0047] Step (1.4.2.2) calculates the adjacency matrix of the hypergraph G2;

[0048] Step (1.4.3) constructs the hypergraph G3 based on the "single relation motif", as follows:

[0049] Step (1.4.3.1) calculates the relation matrix T according to the Mashup-API call. Proceed to step (1.4.3.2);

[0050] in, This indicates the number of times the same API is called between Mashups;

[0051] Step (1.4.3.2) is based on the matrix. Calculate matrix T * Proceed to step (1.4.3.3);

[0052] Wherein, matrix T * By taking the matrix The top right corner of the diagonal is used to construct the structure by setting all numbers greater than 0 to 1, representing whether Mashups call the same API;

[0053] Step (1.4.3.3) calculates the adjacency matrix of the hypergraph G3;

[0054] The adjacency matrix S3 of the hypergraph G3 is calculated as S3 = T * T *" ;

[0055] Step (1.4.4) involves calculating the adjacency matrix of the hypergraph G4 and comparing it with the upper triangular matrix R based on the "composite relation schema".* Calculate the Hadamard product and construct the hypergraph G4 by computing the adjacency matrix of the hypergraph G4.

[0056] The adjacency matrix S4 of the hypergraph G4 is calculated as S4 = (T * T * ")⊙R * This means filtering out Mashup pairs that do not carry the same label;

[0057] Preferably, the processing procedure of step (1.4.2.2) is as follows:

[0058] Step (1.4.2.2.1) defines the adjacency matrix S2 as the adjacency matrix of the hypergraph G2;

[0059] Step (1.4.2.2.2) Iterate through the Mashup set M and initialize the value i to 1 to record the Mashup number. Then perform steps (1.4.2.2.2.1-1.4.2.2.2.3) to calculate all values ​​in the i-th row of S2.

[0060] Step (1.4.2.2.2.1) iterates through the Mashup set M and initializes the value j to 1 to record the Mashup number. Then, steps (1.4.2.2.2.1.1-1.4.2.2.2.1.3) are performed to calculate S2 in S2. i,j The value;

[0061] Among them, S2 i,j This represents the value in the i-th row and j-th column of the adjacency matrix S2;

[0062] Step (1.4.2.2.2.1.1) queries matrix R to confirm whether the number of identical labels carried by Mashup i and Mashup j is greater than 1. If so, then S2 i,j Set to 1, otherwise set to 0, and proceed to step (1.4.2.2.2.1.2);

[0063] In step (1.4.2.2.2.1.2), take j = j + 1 and proceed to step (1.4.2.2.2.1.3);

[0064] Step (1.4.2.2.2.1.3) determines whether j is less than or equal to N. If yes, return to step (1.4.2.2.2.1.1); otherwise, exit the loop.

[0065] In step (1.4.2.2.2.2), take i = i + 1 and proceed to step (1.4.2.2.2.3);

[0066] Step (1.4.2.2.2.3) determines whether i is less than or equal to N. If yes, return to step (1.4.2.2.2.1); otherwise, exit the loop.

[0067] In step (2.1), the convolution weight matrix c i,j This represents the value in the i-th row and j-th column of matrix C. Let N represent a matrix of size N×N consisting of real numbers, where ∈ denotes the membership relationship between an element and a set; the process is as follows:

[0068] Step (2.1.1) To avoid the random walk converging to a stationary distribution determined solely by the degree of each node, the reference part absorbs the random walk. Let the random process X = {X... t The transition probability matrix for t≥0 is:

[0069]

[0070] Partially absorbing random walks are a type of second-order Markov chain where, in each state, there is a certain probability of remaining in the current state or transitioning to the next state, determined by the transition probability p. i,j Decide;

[0071] in, Where, d i S represents the degree of vertex i, where degree represents the number of edges connecting the vertex to the graph. i,j Let λ represent the value in the i-th row and j-th column of the adjacency matrix S. i ∈Λ,Λ=diag(λ1,λ2,…,λ N ) is a regularized matrix in which all values ​​are greater than 0, where diag() indicates that the elements in the brackets form a diagonal matrix, and the formula for calculating Λ is Λ=δI, where I represents the identity matrix and δ represents the weight coefficient. The absorption probability between nodes can be adjusted by adjusting δ.

[0072] Step (2.1.2) combines the parameter matrix Q with P to obtain the formula for calculating the convolution weights on the hypergraph.

[0073]

[0074] Here, Q is the parameter matrix used to adjust the transition probabilities in a biased random walk. The biased random walk combines breadth-first and depth-first sampling strategies to adjust the transition probabilities, thereby balancing homogeneity and structural equivalence. This allows for flexible searching of complex network structures. The element q in the i-th row and j-th column of matrix Q is... i,j The calculation formula is

[0075] Breadth-first search (BFS) and depth-first search (DFS) are two common search strategies. BFS traverses the graph or tree structure level by level, visiting all adjacent nodes first, then visiting the nodes at the next level, and is suitable for finding the shortest path. DFS explores down a branch to its end, then backtracks to the previous branch, and is suitable for finding all possible solutions. Where d... i,j Let represent the shortest distance between nodes i and j, and p and q be parameters for adjusting the traversal strategy; where homogeneity means that two nodes belonging to the same cluster are more similar, and structural equivalence means that two nodes with the same structural role are more similar.

[0076] The process of the third step is as follows:

[0077] Step (3.1) combines the convolution weight matrix with a traditional hypergraph convolutional network. Based on LightGCN, it discards feature transformation and activation function, simplifies the convolution operation, and defines the convolution operation as X. (l+1) =D (-1) SX (l) ;

[0078] LightGCN is a recommendation algorithm based on graph neural networks. It improves efficiency and performance by simplifying the model structure, is easy to understand and interpret, and is widely used. Feature transformation refers to methods that derive new features from original features through certain rules or mappings. Activation functions refer to the functional relationship between the output of upper-layer nodes and the input of lower-layer nodes in a multi-layer neural network. (l) and X (l+1) Let S represent the input and output of a single convolution, and D represent the adjacency matrix. (-1) Indicate the inverse of matrix D;

[0079] Step (3.2) involves inputting the convolution weight matrix C and performing a hypergraph convolution operation;

[0080] The formula for a single-layer convolution is X. (l+1) =CX (l) The convolution formula for a hypergraph convolutional network with L layers of convolution is y. (L) =C…(CX) (0) );

[0081] in, Let C represent the input matrix composed of the embedding matrices of the hypergraph vertices. Since this invention uses a multi-channel hypergraph convolutional network, C in the formula can be replaced by the convolution weight matrices C1, C2, C3, and C4 of hypergraphs G1, G2, G3, and G4, to obtain the output result y1. (L) y2 (L) y3 (L) y4 (L) ;

[0082] Where s represents the embedding length.

[0083] Step (3.3) averages the output of each convolution to obtain the final output of each channel;

[0084] Among them, y n The calculation formula is

[0085] The process of step (4.1) is as follows:

[0086] Step (4.1.1) directly uses the output results of different channels to calculate the loss and obtain the error between the estimated value and the true value of the channel.

[0087] The formula for calculating the error is as follows:

[0088] Among these, the smaller the error value, the stronger the discriminative features extracted by that channel, and therefore the larger the weight should be. Φ represents the model parameters. Mashup m i with API a j The scoring function, Mashup m i with API a k The scoring function.

[0089] Step (4.1.2) introduces the error from step (4.1.1) into the channel attention mechanism, resulting in a novel channel error attention formula, which is:

[0090]

[0091] Channel attention is a technique used to enhance the performance of neural networks, primarily applied in fields such as computer vision and natural language processing. Its core idea is to assign different weights to different channels of the feature map, thereby highlighting important features and suppressing irrelevant ones.

[0092] in, and Both are learnable weight matrices, and exp(·) represents an exponential function with the natural number e as the base.

[0093] In step (4.2), the formula for calculating the hypergraph vertex representation is:

[0094] The process of the fifth step is as follows:

[0095] Step (5.1) aggregates the information of the APIs connected to the Mashup into the Mashup, and then proceeds to step (5.2);

[0096] The aggregation formula is: Among them, y a (l) This represents the embedding of the API in the l-th layer convolution on the Mashup-API call graph. This represents the embedding of the l-th convolution in the Mashup API call graph;

[0097] Step (5.2) aggregates the information of the Mashup connected to the API into the API. If l = L1, then execute step (5.3); otherwise, increment l by 1 and return to step (5.1).

[0098] Where L1 represents the total number of convolutional layers, and the aggregation formula is:

[0099]

[0100] Among them, y m (l) This is a combined output of a multi-channel hypergraph convolutional network and graph convolution results. Let D be the input matrix consisting of the embedding matrices of the Mashup. i and D ii Let T and T" be the degree matrices, respectively;

[0101] Step (5.3) combines the interaction information between Mashups and the interaction information between Mashup-APIs to obtain the embedded representations of Mashups and APIs. The embedding calculation formula is as follows:

[0102] The process of the sixth step is as follows:

[0103] Step (6.1) calculates the similarity between the embedding representations of Mashup m obtained based on the interaction information between Mashups and the interaction information between Mashup-APIs through the inner product.

[0104] Among them, P m This represents the embedding representation of Mashup m obtained based on the interaction information between Mashups. This represents the embedding representation obtained by Mashupm based on the interaction information between Mashup-APIs, f out (·,·) denotes the similarity scoring function between two vectors, which is defined as the inner product of the two vectors.

[0105] Step (6.2) follows the SimCLR format, using InfoNCE as the target of contrastive learning, and defines the formula for calculating the contrastive learning loss as follows:

[0106] Here, γ is an adjustable temperature parameter.

[0107] By maximizing the mutual information between the two representations through contrastive learning, the model's performance is improved. SimCLR is a self-supervised learning framework designed to learn visual representations through contrastive learning. InfoNCE is the loss function of SimCLR, and its core idea is to learn effective representations by comparing the similarity between positive and negative samples.

[0108] The process of the seventh step is as follows:

[0109] Step (7.1) scores the matching degree between the Mashup's embedding expression and the API's embedding expression to obtain the top K matching APIs;

[0110] Among them, Mashup m i with API a j Match score By calculating Y g and Y a The inner product is obtained from the product between them;

[0111] Step (7.2) calculates the model loss and adjusts the model parameters;

[0112] The loss of the recommendation model is represented by the BPR loss, a loss function used to learn personalized user preferences in the recommendation system, which can encourage positive samples to rank higher than negative samples. Here, positive samples represent API samples actually called by the current Mashup, and negative samples represent API samples not actually called by the current Mashup. The formula for calculating the loss function is as follows:

[0113]

[0114] in, Mashup m i with API a j Match score Mashup m i with API a k The inter-match score is represented by log, where log represents the logarithmic function, σ represents a learnable weight matrix, and Φ represents the model parameters. This indicates a "not belonging" relationship between an element and a set.

[0115] Step (7.3) combines dual-scale contrastive learning to extend the recommendation task into a multi-objective optimization recommendation task. Using Bayesian personalized ranking loss as the primary objective and contrastive learning loss as the secondary objective, the final objective is... Where ρ is a manually set hyperparameter, i.e., the weight of the secondary objective.

[0116] The beneficial effects of this invention are that by introducing a multi-channel hypergraph convolutional network and utilizing four motif structures, including co-associative motifs, the model can more accurately capture the complex relationships between service data, thus improving recommendation accuracy. The hybrid random walk algorithm optimizes the convolution weight matrix, reducing the impact of noise and further improving recommendation performance. Simultaneously, it simplifies convolution operations, enhancing computational efficiency and model generalization ability. The dual-scale contrastive learning method improves the model's robustness, ensuring stability and reliability when processing complex data. This invention provides an effective solution for Web API recommendation systems, significantly improving their accuracy and efficiency. Attached Figure Description

[0117] Figure 1 The overall architecture of the present invention is shown. Detailed Implementation

[0118] The present invention will now be further described with reference to the accompanying drawings.

[0119] Reference Figure 1 A data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization includes the following steps:

[0120] The first step is to extract the service hypergraph based on the service motif, as follows:

[0121] Step (1.1) Crawl Mashup service information from relevant API websites;

[0122] Step (1.2) analyzes the crawled Mashup service set and selects metadata that is beneficial to improving the accuracy of service recommendations and is rich in content;

[0123] The retained metadata includes Mashup, API, the call relationship between Mashup and API, and the tags carried by Mashup;

[0124] The Mashup set is defined as M = {m1, m2, ..., m}. N}, where N is the total number of Mashups in the set, and m is the number of Mashups. i The API set called is A i ={a i,1 ,a i,2 ,a i,3 ,…,a i,k}, k is Mashup m i The total number of APIs called, and the set of APIs called by all Mashups. Where ∪ represents finding the union of all sets, and the Mashup-API call relationships are stored in a 0-1 matrix. middle, Represents the set of real numbers. Let A be a matrix of size N×|A| consisting of real numbers, where |A| represents the number of elements in set A, and each pair of Mashup m and API a,t is involved. m,a =1 indicates that Mashup m and API a have a calling relationship, t m,a =0 indicates that Mashup m and API a do not have a calling relationship;

[0125] In this invention, labels represent some functions or attributes of the Mashup, and the label information includes collaboration information between the Mashup and its API. Therefore, the feature mining process for both the API and the Mashup utilizes not only call information but also label information. This invention uses a 0-1 matrix. This represents the carrying relationship between tags and Mashups. Specifically, for each pair of Mashups m and tags ta, R... m,ta =1 indicates that there is a carry relationship between Mashup m and label ta, R m,ta =0 indicates that Mashup m and tag ta have no carrying relationship;

[0126] Step (1.3) summarizes four types of motifs: co-associative motifs, multiple strongly associated motifs, single relation motifs, and composite relation motifs;

[0127] Among them, motifs represent connection patterns that occur repeatedly in the network and are significantly more numerous than those in other complex networks. These connection patterns often contain key information about the network, and numerous studies have demonstrated that motifs have the substantial ability to bridge the gap between microscopic and macroscopic structural information.

[0128] The four types of phantoms are described in detail below:

[0129] Shared-label motifs: In Mashup invocation scenarios, if two Mashups carry the same label, this invention refers to this as a shared-label relationship. In service data, if Mashups have pairwise shared-label relationships and form a ternary closure structure, this is called a shared-label motif.

[0130] The triplet closure is a concept in social network theory, which refers to a property of a triplet consisting of three nodes A, B, and C, namely, that there are strong connections between A and B, A and C, and B and C.

[0131] Multiple strongly associated motifs: The diversity of tags and the artificial definition of tags cause uncertainty in the tags carried by Mashups. This invention defines the relationship between a pair of Mashups carrying two or more identical tags as a strong association relationship, and defines the structure of multiple Mashups forming a closed loop with strong association relationships as a multiple strongly associated motif.

[0132] Single Relationship Module: The calling relationship between a Mashup and its API reflects the functional characteristics of the Mashup. Two Mashups that call the same API have similar functions. This invention defines a module in which two Mashups call the same API as a single relationship module.

[0133] Composite relational module: Mashups that call the same API and carry the same label. In order to use this feature to explore the relationship between Mashups, this invention defines Mashups that call the same API and have the same label relationship as composite relational modules.

[0134] Step (1.4) Based on the model proposed in step (1.3), proceed with steps (1.4.1-1.4.4) to construct a multi-channel hypergraph;

[0135] Hypergraphs are a generalization of traditional pairwise graphs. In traditional graph theory, graphs consist of nodes (vertices) and edges, while hypergraphs introduce the concept of hyperedges. A hyperedge is a set connecting multiple nodes, not just two. This allows hypergraphs to better describe complex relationships and higher-order associations. This invention uses motifs to construct multi-channel hypergraphs, where each motif constitutes a hyperedge.

[0136] The process of step (1.4) is as follows:

[0137] Step (1.4.1) Constructs the hypergraph G1 based on the "commonly related motifs";

[0138] Step (1.4.1.1) calculates the relation matrix R based on the Mashup-label carried relation matrix. Proceed to step (1.4.1.2);

[0139] in, This indicates that the Mashups carry the same number of tags. The "" indicates the transpose of the matrix.

[0140] Step (1.4.1.2) Construct the upper triangular matrix R * This is used to indicate whether Mashups carry the same tag, and to proceed to step (1.4.1.3);

[0141] Among them, R * From the matrix Take the top right corner of the diagonal and set all numbers greater than 0 to 1;

[0142] Step (1.4.1.3) calculates the adjacency matrix of the hypergraph G1;

[0143] The adjacency matrix is ​​a matrix that represents the adjacency relationships between vertices in a hypergraph. The adjacency matrix S1 of hypergraph G1 is calculated as S1 = (R... * R * )⊙R * Where ⊙ denotes the Hadamard product of the matrices on both sides;

[0144] Step (1.4.2) constructs the hypergraph G2 based on the "multiple strongly correlated motifs";

[0145] Step (1.4.2.1) constructs a matrix R′ to represent whether Mashups carry two or more identical labels, and proceeds to step (1.4.2.2);

[0146] Where, matrix R′ is obtained by taking the matrix The upper triangular matrix is ​​constructed by setting all numbers greater than 2 to 1 and the rest to 0 in the upper right corner of the diagonal.

[0147] Step (1.4.2.2) involves performing steps (1.4.2.2.1-1.4.2.2.2) to calculate the adjacency matrix of the hypergraph G2;

[0148] Step (1.4.2.2.1) defines the adjacency matrix S2 as the adjacency matrix of the hypergraph G2;

[0149] Step (1.4.2.2.2) Iterate through the Mashup set M and initialize the value i to 1 to record the Mashup number. Then perform steps (1.4.2.2.2.1-1.4.2.2.2.3) to calculate all values ​​in the i-th row of S2.

[0150] Step (1.4.2.2.2.1) iterates through the Mashup set M and initializes the value j to 1 to record the Mashup number. Then, steps (1.4.2.2.2.1.1-1.4.2.2.2.1.3) are performed to calculate S2 in S2. i,j The value;

[0151] Among them, S2 i,j This represents the value in the i-th row and j-th column of the adjacency matrix S2;

[0152] Step (1.4.2.2.2.1.1) queries matrix R to confirm whether the number of identical labels carried by Mashup i and Mashup j is greater than 1. If so, then S2 i,j Set to 1, otherwise set to 0, and proceed to step (1.4.2.2.2.1.2);

[0153] In step (1.4.2.2.2.1.2), take j = j + 1 and proceed to step (1.4.2.2.2.1.3);

[0154] Step (1.4.2.2.2.1.3) determines whether j is less than or equal to N. If yes, return to step (1.4.2.2.2.1.1); otherwise, exit the loop.

[0155] In step (1.4.2.2.2.2), take i = i + 1 and proceed to step (1.4.2.2.2.3);

[0156] Step (1.4.2.2.2.3) determines whether i is less than or equal to N. If yes, it returns to step (1.4.2.2.2.1); otherwise, it exits the loop.

[0157] Step (1.4.3) Construct the hypergraph G3 based on the "single relation motif";

[0158] Step (1.4.3.1) calculates the relation matrix T according to the Mashup-API call. Proceed to step (1.4.3.2);

[0159] in, This indicates the number of times the same API is called between Mashups;

[0160] Step (1.4.3.2) is based on the matrix. Calculate matrix T * Proceed to step (1.4.3.3);

[0161] Wherein, matrix T * By taking the matrix The top right corner of the diagonal is used to construct the structure by setting all numbers greater than 0 to 1, representing whether Mashups call the same API;

[0162] Step (1.4.3.3) calculates the adjacency matrix of the hypergraph G3;

[0163] The adjacency matrix S3 of the hypergraph G3 is calculated as S3 = T * T *" ;

[0164] Step (1.4.4) involves calculating the adjacency matrix of the hypergraph G4 and comparing it with the upper triangular matrix R based on the "composite relation schema". * Calculate the Hadamard product and construct the hypergraph G4 by computing the adjacency matrix of the hypergraph G4.

[0165] The adjacency matrix S4 of the hypergraph G4 is calculated as S4 = (T * T*" )⊙R * This means filtering out Mashup pairs that do not carry the same label;

[0166] The second step is to calculate the convolution weight matrix C of the multi-channel hypergraph using a hybrid random walk algorithm.

[0167] Random walk is a mathematical statistical model consisting of a series of trajectories, representing a stochastic process. In random walk, each move is based on random factors rather than predetermined rules. After hypergraph extraction based on motif structure, the current neighborhood partitioning is relatively coarse, and directly convolving this hypergraph can easily introduce noise. Random walk can be used to calculate a hypergraph convolution weight matrix to optimize hypergraph convolution.

[0168] The second step is as follows:

[0169] Step (2.1) proposes a hybrid random walk algorithm based on combining partially absorbed random walk and biased random walk, and executes steps (2.1.1-2.1.2) to calculate the convolution weight matrix C on the hypergraph;

[0170] Wherein, the convolution weight matrix in, Let c represent the set of real numbers. i,j This represents the value in the i-th row and j-th column of matrix C. Let represent a matrix of size N×N consisting of real numbers, where ∈ indicates a membership relationship between an element and a set;

[0171] Step (2.1.1) To avoid the random walk converging to a stationary distribution determined solely by the degree of each node, the reference part absorbs the random walk. Let the random process X = {X... t The transition probability matrix for t≥0 is:

[0172]

[0173] Partially absorbing random walks are a type of second-order Markov chain, characterized by a certain probability of remaining in the current state or transitioning to the next state at each state, determined by the transition probability p. i,j The decision is made to capture the global semantic structure of the topology. Once a walk stops at a certain state, it will remain in that state indefinitely, meaning it is absorbed into the current state.

[0174] in, Where, d i S represents the degree of vertex i, where degree represents the number of edges connecting the vertex to the graph. i,j Let λ represent the value in the i-th row and j-th column of the adjacency matrix S. i∈Λ,Λ=diag(λ1,λ2,...,λ N Let be a regularized matrix where all values ​​are greater than 0, where diag() indicates that the elements in the brackets form a diagonal matrix, and the formula for calculating Λ is Λ=δI. Here, I represents the identity matrix, and δ represents the weight coefficient. Adjusting δ can regulate the absorption probability between nodes. Step (2.1.2) combines the parameter matrix Q with P to obtain the formula for calculating the convolution weights on the hypergraph.

[0175]

[0176] Here, Q is the parameter matrix used to adjust transition probabilities in a biased random walk. Biased random walks combine breadth-first and depth-first sampling strategies to adjust transition probabilities, thereby balancing homogeneity and structural equivalence. This allows for flexible searching of complex network structures. The element q in the i-th row and j-th column of matrix Q is... i,j The calculation formula is

[0177] Breadth-first search (BFS) and depth-first search (DFS) are two common search strategies. BFS traverses the graph or tree structure level by level, visiting all adjacent nodes first, then proceeding to the next level, and is suitable for finding the shortest path. DFS explores a branch downwards to its end, then backtracks to the previous branch, and is suitable for finding all possible solutions. Where d... i,j Let represent the shortest distance between nodes i and j, and p and q be parameters for adjusting the traversal strategy. Homogeneity indicates that two nodes belonging to the same cluster are more similar, and structural equivalence indicates that two nodes with the same structural role are more similar.

[0178] Step (2.2) Based on the weight calculation formula, we further obtain Λ(CI)+CD=(W⊙Q)C, where D represents the degree matrix of the hypergraph. The degree matrix is ​​a diagonal matrix, and its diagonal elements represent the degree of the corresponding vertex.

[0179] Where W represents the weight between nodes determined by degree, and the element in the i-th row and j-th column of the matrix can be represented as...

[0180]

[0181] Step (2.2.3) further calculates and derives the closed-form of the convolution weight matrix: C = (Λ + L). -1 Λ;

[0182] Where L = DW⊙Q;

[0183] The third step involves performing convolution operations on the hypergraph and aggregating the convolution results across multiple channels to obtain the Mashup embedding representation. The process is as follows:

[0184] Step (3.1) combines the convolution weight matrix with a traditional hypergraph convolutional network. Based on LightGCN, it discards feature transformation and activation function, simplifies the convolution operation, and defines the convolution operation as X. (l+1) =D (-1) SX (l) ;

[0185] LightGCN is a recommendation algorithm based on graph neural networks. It improves efficiency and performance by simplifying the model structure, is easy to understand and interpret, and is widely used. Feature transformation refers to methods that derive new features from original features through certain rules or mappings. Activation functions refer to the functional relationship between the output of upper-layer nodes and the input of lower-layer nodes in a multi-layer neural network. (l) and X (l+1) Let S represent the input and output of a single convolution, and D represent the adjacency matrix. (-1) Indicate the inverse of matrix D;

[0186] Step (3.2) involves inputting the convolution weight matrix C and performing a hypergraph convolution operation;

[0187] The formula for a single-layer convolution is X. (l+1) =CX (l) The convolution formula for a hypergraph convolutional network with L layers of convolution is y. (L) =C…(CX) (0) );

[0188] in, Let C represent the input matrix composed of the embedding matrices of the hypergraph vertices. Since this invention uses a multi-channel hypergraph convolutional network, C in the formula can be replaced by the convolution weight matrices C1, C2, C3, and C4 of hypergraphs G1, G2, G3, and G4, to obtain the output result y1. (L) y2 (L) y3 (L) y4 (L) ;

[0189] Where s represents the embedding length.

[0190] Step (3.3) averages the output of each convolution to obtain the final output of each channel;

[0191] Among them, y n The calculation formula is

[0192] Step 4: Based on the channel error attention mechanism and the output of each channel, the process is as follows:

[0193] Step (4.1) uses a channel error attention mechanism to calculate the weight of each channel.

[0194] Step (4.1.1) directly uses the output results of different channels to calculate the loss and obtain the error between the estimated value and the true value of the channel.

[0195] The formula for calculating the error is as follows:

[0196] Among these, the smaller the error value, the stronger the discriminative features extracted by that channel, and therefore the larger the weight should be. Φ represents the model parameters. Mashup m i with API a j The scoring function, Mashup m i with API a k The scoring function.

[0197] Step (4.1.2) introduces the error from step (4.1.1) into the channel attention mechanism, resulting in a novel channel error attention formula, which is:

[0198]

[0199] Channel attention is a technique used to enhance the performance of neural networks, primarily applied in fields such as computer vision and natural language processing. Its core idea is to assign different weights to different channels of the feature map, thereby highlighting important features and suppressing irrelevant ones.

[0200] in, and Both are learnable weight matrices, and exp(·) represents an exponential function with the natural number e as the base.

[0201] Step (4.2) aggregates the outputs of each channel according to their weights to obtain a complete representation of the hypergraph vertices; wherein, the calculation formula for the hypergraph vertex representation is:

[0202] Step 5: Perform convolution on the Mashup-API call graph to obtain the API embedding representation. The process is as follows:

[0203] Step (5.1) aggregates the information of the APIs connected to the Mashup into the Mashup, and then proceeds to step (5.2);

[0204] The aggregation formula is: Among them, y a (l) This represents the embedding of the API in the l-th layer convolution on the Mashup-API call graph. This represents the embedding of the l-th convolution in the Mashup API call graph;

[0205] Step (5.2) aggregates the information of the Mashup connected to the API into the API. If l = L1, then execute step (5.3); otherwise, increment l by 1 and return to step (5.1).

[0206] Where L1 represents the total number of convolutional layers, and the aggregation formula is:

[0207]

[0208] Among them, y m (l) This is a combined output of a multi-channel hypergraph convolutional network and graph convolution results. Let D be the input matrix consisting of the embedding matrices of the Mashup. i and D ii Let T and T" be the degree matrices, respectively;

[0209] Step (5.3) combines the interaction information between Mashups and the interaction information between Mashup-APIs to obtain the embedded representations of Mashups and APIs. The embedding calculation formula is as follows:

[0210] Step 6: Propose a dual-scale contrastive learning method to maximize the consistency between the same node and the differences between different nodes obtained through two different approaches, thereby enabling the recommendation model to obtain more information.

[0211] Among them, consistency and difference are reflected in the degree of similarity.

[0212] The process of the sixth step is as follows:

[0213] Step (6.1) calculates the similarity between the embedding representations of Mashup m obtained based on the interaction information between Mashups and the interaction information between Mashup-APIs through the inner product.

[0214] Among them, P m This represents the embedding representation of Mashup m obtained based on the interaction information between Mashups. This represents the embedding representation obtained by Mashupm based on the interaction information between Mashup-APIs, f out (·,·) denotes the similarity scoring function between two vectors, which is defined as the inner product of the two vectors.

[0215] Step (6.2) follows the SimCLR format, using InfoNCE as the target of contrastive learning, and defines the formula for calculating the contrastive learning loss as follows:

[0216] Here, γ is an adjustable temperature parameter.

[0217] By maximizing the mutual information between the two representations through contrastive learning, the model's performance is improved. SimCLR is a self-supervised learning framework designed to learn visual representations through contrastive learning. InfoNCE is the loss function of SimCLR, and its core idea is to learn effective representations by comparing the similarity between positive and negative samples.

[0218] Step 7: Optimize the model based on the recommendation results, as follows:

[0219] Step (7.1) scores the matching degree between the Mashup's embedding expression and the API's embedding expression to obtain the top K matching APIs;

[0220] Among them, Mashup m i with API a j Match score By calculating Y g and Y a The inner product is obtained from the product between them;

[0221] Step (7.2) calculates the model loss and adjusts the model parameters;

[0222] The loss of the recommendation model is represented by the BPR loss, a loss function used to learn personalized user preferences in the recommendation system, which can encourage positive samples to rank higher than negative samples. Here, positive samples represent API samples actually called by the current Mashup, and negative samples represent API samples not actually called by the current Mashup. The formula for calculating the loss function is as follows:

[0223]

[0224] in, Mashup m i with API a j Match score Mashup m i with API a k The inter-match score, log represents the logarithmic function, σ represents a learnable weight matrix, and Φ represents the model parameters;

[0225] Step (7.3) combines dual-scale contrastive learning to extend the recommendation task into a multi-objective optimization recommendation task. Using Bayesian personalized ranking loss as the primary objective and contrastive learning loss as the secondary objective, the final objective is... Where ρ is a manually set hyperparameter, i.e., the weight of the secondary objective.

[0226] The embodiments of the present invention are as follows:

[0227] Step 1: Selecting a reference method

[0228] The recommendation method of this invention is compared with a variety of very typical or advanced recommendation methods, which can be divided into three categories: collaborative filtering methods, neural network methods, and graph neural network methods.

[0229] 1) Collaborative filtering method:

[0230] PRCUM: Models a Mashup by mining the descriptive text to find its nearest neighbor Mashup set, and uses this nearest neighbor set to enrich the user model and find recommended APIs.

[0231] NHSM: Uses a novel similarity model that combines local information about the similarity between a Mashup and an API, as well as global information about the relationship between a Mashup and an API call, to improve recommendation performance.

[0232] 2) Neural network method:

[0233] NCF: Combines neural networks and traditional collaborative filtering techniques to model Mashup-API interactions, solves implicit feedback-based collaborative filtering, and uses multilayer perceptrons to learn the interaction functions of Mashup-API.

[0234] LRML: Building upon simple metric learning, it introduces an enhanced memory module to learn a relation vector specific to each Mashup-API pair, using this relation vector to model the relationship between Mashups and APIs in the metric space.

[0235] 3) Graph Neural Network Method:

[0236] DGCF: Models the call relationships of Mashup APIs and effectively extracts information related to the intent of each Mashup through deentangled representation, making the recommendation model interpretable.

[0237] NGCF: This is a graph-based collaborative filtering method that integrates the information relationship between neighboring nodes and the current node during propagation through element-wise product.

[0238] LightGCN is an efficient graph convolutional recommendation model that uses graph convolution to obtain the embedding matrices of Mashups and APIs, and matches APIs and Mashups based on distance.

[0239] NIA-GCN: This is a neural network model based on GCN that combines attention mechanisms to capture complex interaction patterns between nodes in graph data, thereby achieving more accurate prediction and inference.

[0240] S 2 -MHCN: Uses social network motifs to build multi-channel hypergraphs for Mashup sets, uses attention mechanisms to combine information from different hypergraphs, and uses self-supervised learning to adjust the Mashup representation to reduce splicing errors.

[0241] Step 2: Crawl Mashup service data from the ProgrammableWeb platform and conduct experiments. Since a key goal of service recommendation is to alleviate the problem of data sparsity, in order to verify the ability of the model of this invention to handle sparse data, the service data is processed and a dense dataset is created to be compared with the original sparse dataset.

[0242] In the dense dataset, only Mashups with 5 or more API calls are retained.

[0243] Step 3: Select one metric related to the ranking order, Normalized Discounted Cumulative Gain (NDCG), and one metric unrelated to the ranking order, Hit Rate (HR), as the evaluation metrics for the model recommendation results.

[0244] The NDCG metric is a normalized representation of the Discounted Cumulative Gain (DCG). This metric takes into account the recommendation order; recommendations ranked higher have a higher normalized DCG. Specifically, it is expressed as follows: Where K represents the number of recommended APIs, n represents the service's ranking in the recommendation list, and IDCG represents the ideal DCG. HR is a commonly used Top-N evaluation metric, especially in cases where recommendation order is irrelevant; a higher HR value indicates better recommendation performance. Its calculation method is as follows: Here, hit(i) indicates whether API i is matched in Mashup's recommendation list, and N represents the actual number of API calls made by Mashup.

[0245] Step 4: Compare through experiments.

[0246] The performance of the method of this invention was compared with other baseline methods in experiments covering both dense and sparse datasets. The comparison results are shown in the table below. The best results for each metric are indicated in bold, and the second-best results are indicated by underscores. Analysis of the data in the table yields the following results:

[0247] Table 1

[0248]

[0249] Collaborative filtering methods PRCUM and NHSM performed poorly across various metrics, particularly the order-related metric NDCG@K. The PRCUM method mines the relationship between the Mashup and the API through descriptive text, but since both the API and Mashup descriptive texts are short, the recommendation results are unsatisfactory. The NHSM method additionally introduces the call relationship between the Mashup and the API as the basis for their relationship, which improves the recommendation performance. However, the sparse call relationship also affects the recommendation effect.

[0250] The neural network approach introduces neural network technology to model the relationship between Mashups and APIs, focusing more on the underlying connections between them. By learning the non-linear features of services and considering the representational and generalization capabilities of feature vectors, it can better learn the relationship features between services, improve recommendation performance, and outperform collaborative filtering methods in various metrics.

[0251] Graph neural network (GNN) methods performed best among all types of methods. DGCF and NGCF, by fusing collaborative filtering with GNNs, better integrate Mashups and API call relationships into the embedding representation, making them more suitable for the recommendation task of this invention than ordinary neural network methods. LightGCN reduces oversmoothing by discarding feature changes and non-linear activation functions in conventional graph convolutions, thus improving recommendation performance. NIA-GCN utilizes the structural characteristics of graphs to propose various information aggregation mechanisms, more effectively aggregating node information and further improving recommendation performance. 2 -MHCN establishes motifs and uses them to construct multiple hypergraphs, solving the sparsity problem commonly found in graph convolution. However, due to S... 2 The motifs in the MHCN method are based on social scenarios and cannot fully consider the relationships between mashups and tags, APIs and tags, and the relationships derived therefrom in service recommendation scenarios. Therefore, it is not suitable for recommendation scenarios based on service data, affecting the recommendation results.

[0252] The proposed method outperforms all baseline methods across various metrics. Specifically, in sparse and dense datasets, NDCG@5 and HR@5 show improvements of 6.52%, 5.52%, 3.85%, and 2.69% respectively compared to the suboptimal results. Compared to other conventional graph neural network methods, the superior performance of this invention demonstrates the effectiveness of building motifs based on the relationship structure between common Mashups, APIs, and additional information such as labels, and extracting hypergraphs through these motifs. The hybrid random walk also correctly adjusts the connection relationships and weights between nodes, and the hypergraph structure can effectively utilize higher-order information between Mashups and APIs, as well as between Mashups themselves, thereby improving the model's recommendation performance.

[0253] The embodiments described in this specification are merely examples of implementations of the inventive concept and are for illustrative purposes only. The scope of protection of this invention should not be considered limited to the specific forms described in these embodiments; rather, it extends to equivalent technical means conceived by those skilled in the art based on the inventive concept.

Claims

1. A data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization, characterized in that, The method includes the following steps: The first step is to extract the service hypergraph based on the service motif, as follows: Step (1.1) Crawl Mashup service information from relevant API websites; Step (1.2) analyzes the crawled Mashup service set and selects metadata that is beneficial to improving the accuracy of service recommendations and is rich in content; Step (1.3) summarizes four types of motifs: co-associative motifs, multiple strongly associated motifs, single relation motifs, and composite relation motifs; Step (1.4) Construct a multi-channel hypergraph based on the phantom proposed in step (1.3); The second step is to calculate the convolution weight matrix C of the multi-channel hypergraph using a hybrid random walk algorithm, as follows: Step (2.1) proposes a hybrid random walk algorithm based on the combination of partially absorbed random walk and biased random walk, and calculates the convolution weight matrix C on the hypergraph; Step (2.2) further obtains the weight calculation formula. ,in, Let be a regularization matrix where all values ​​are greater than 0, D represents the degree matrix of the hypergraph, which is a diagonal matrix whose diagonal elements represent the degree of the corresponding vertex; W represents the weight between nodes determined by degree, and Q is the parameter matrix used to adjust the transition probability in a biased random walk. Step (2.3) further calculates and derives the closed-form of the convolution weight matrix. ;in, ; The third step is to perform convolution operations on the hypergraph and aggregate the convolution results on multiple channels to obtain the Mashup embedding representation. Step 4: Based on the channel error attention mechanism and the output of each channel, the process is as follows: Step (4.1) uses a channel error attention mechanism to calculate the weight of each channel; Step (4.2) aggregates the outputs of each channel according to their weights to obtain a complete representation of the hypergraph vertices; Step 5: Perform convolution on the Mashup-API call graph to obtain the embedded representation of the API; Step 6: Propose a dual-scale contrastive learning method to maximize the consistency between the same node and the differences between different nodes obtained through two different approaches, thereby enabling the recommendation model to obtain more information. Step 7: Optimize the model based on the recommendation results.

2. The data service recommendation method that integrates dual-scale contrastive learning and multi-objective optimization as described in claim 1, characterized in that, In step (1.2), the retained metadata includes Mashup, API, the calling relationship between Mashup and API, and the tags carried by Mashup; Among them, the Mashup set is defined as Where N is the total number of Mashups in the set, and Mashup The set of APIs called is , For Mashup The total number of APIs called, and the set of APIs called by all Mashups. ,in This indicates finding the union of all sets; the Mashup-API call relationships are stored in a 0-1 matrix. middle, Represents the set of real numbers. It represents a set of real numbers with a value of 1. The matrix, Represents a set The number of elements in the matrix, where each pair of Mashup m and API a is involved. Mashup With API There is a calling relationship. Mashup With API There is no calling relationship; Here, the labels represent some functions or attributes of the Mashup. The label information includes the collaboration information between the Mashup and the API. Therefore, the feature mining process of the API and Mashup uses not only the call information but also the label information, using a 0-1 matrix. This represents the carrying relationship between a tag and a Mashup, where each pair of Mashup m and tag ta is involved. Mashup There is a carrying relationship with the tag ta. Mashup There is no carrying relationship with the tag ta.

3. The data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization as described in claim 1 or 2, characterized in that, In step (1.3), the four types of phantoms are described as follows: Commonly associated modules: In a Mashup call scenario, if two Mashups carry the same label, it is called a same-label relationship. If there are pairs of Mashups with the same label in the service data and they form a ternary closure structure, it is called a commonly associated module. Multiple strongly associated motifs: The diversity of tags and the artificial definition of tags cause uncertainty in the tags carried by Mashups. The relationship between a pair of Mashups carrying two or more identical tags is defined as a strong association relationship, and the structure of multiple Mashups forming a closed loop with strong association relationships with each other is defined as a multiple strongly associated motif. Single Relationship Module: The relationship between a Mashup and its API reflects the functional characteristics of the Mashup. Two Mashups that call the same API have similar functions. A module in which two Mashups call the same API is defined as a single relationship module. Composite relational motif: Mashups that call the same API and carry the same label are defined as composite relational motifs.

4. The data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization as described in claim 1 or 2, characterized in that, The process of step (1.4) is as follows: Step (1.4.1) constructs the hypergraph G1 based on the "co-associative motifs", as follows: Step (1.4.1.1) involves carrying the relation matrix based on the Mashup-label. calculate Proceed to step (1.4.1.2). in, This indicates that Mashups carry the same number of tags, where This indicates finding the transpose of a matrix; Step (1.4.1.2) Construct the upper triangular matrix This is used to indicate whether Mashups carry the same label, and to proceed with step (1.4.1.3). in, From the matrix Take the top right corner of the diagonal and set all numbers greater than 0 to 1; Step (1.4.1.3) Calculate the adjacency matrix of the hypergraph G1; Here, the adjacency matrix is ​​a matrix that represents the adjacency relationship between vertices in the hypergraph. The adjacency matrix of hypergraph G1 is... The calculation formula is ,in, This indicates the Hadamard product of the matrices on both sides. Step (1.4.2) constructs the hypergraph G2 based on the "multiple strongly associated motifs", as follows: Step (1.4.2.1) Constructing the matrix This is used to indicate whether Mashups carry two or more identical tags, and to proceed with step (1.4.2.2). Among them, matrix To obtain the matrix The upper triangular matrix is ​​constructed by setting all numbers greater than 2 to 1 and the rest to 0 in the upper right corner of the diagonal. Step (1.4.2.2) Calculate the hypergraph G2 The adjacency matrix; Step (1.4.3) Based on the "single relation motif", construct the hypergraph G3 as follows: Step (1.4.3.1) calls the relationship matrix according to the Mashup-API. Calculated Proceed to step (1.4.3.2). in, This indicates the number of times the same API is called between Mashups; Step (1.4.3.2) is based on the matrix. Calculate the matrix Proceed to step (1.4.3.3). Among them, matrix By taking the matrix The top right corner of the diagonal is used to construct the structure by setting all numbers greater than 0 to 1, representing whether Mashups call the same API; Step (1.4.3.3) calculates the adjacency matrix of the hypergraph G3; Among them, the adjacency matrix of the hypergraph G3 S The formula for calculating 3 is S3 = T * T *" ; Step (1.4.4) Based on the "composite relation motif", the adjacency matrix calculation result of the hypergraph G4 is compared with the upper triangular matrix. Calculate the Hadamard product and construct the hypergraph G4 by computing the adjacency matrix of the hypergraph G4. Among them, the adjacency matrix of the hypergraph G4 S The formula for calculating 4 is S4 = (T * T *" )⊙R * This means filtering out Mashup pairs that do not carry the same label; The processing procedure for step (1.4.2.2) is as follows: Step (1.4.2.2.1) defines the adjacency matrix S2 to represent the hypergraph. G2 The adjacency matrix; Step (1.4.2.2.2) Iterate through the Mashup collection M and initialize its values. i 1 is used to record the Mashup number, and steps (1.4.2.2.2.1-1.4.2.2.2.3) are performed to calculate the number of the Mashup in S2. i All values ​​in the row; Step (1.4.2.2.2.1) iterates through the Mashup set M and initializes the value j to 1 to record the Mashup number. Then, proceed with steps (1.4.2.2.2.1.1-1.4.2.2.2.1.3) to calculate S2 in S2. i,j The value; Among them, S2 i,j This represents the value in the i-th row and j-th column of the adjacency matrix S2; Step (1.4.2.2.2.1.1) queries matrix R to confirm whether the number of identical labels carried by Mashup i and Mashup j is greater than 1. If so, then S2 i,j Set to 1, otherwise set to 0, and proceed to step (1.4.2.2.2.1.2). Step (1.4.2.2.2.1.2) takes j = j + 1 and proceeds to step (1.4.2.2.2.1.3). Step (1.4.2.2.2.1.3) determines whether j is less than or equal to N. If yes, return to step (1.4.2.2.2.1.1); otherwise, exit the loop. Step (1.4.2.2.2.2) Take i = i + 1 and proceed to step (1.4.2.2.2.3). Step (1.4.2.2.2.3) determines whether i is less than or equal to N. If yes, return to step (1.4.2.2.2.1); otherwise, exit the loop.

5. The data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization as described in claim 1 or 2, characterized in that, In step (2.1), the convolution weight matrix , Represents the first element in matrix C. Okay, number The value of the column, It represents a set of real numbers with a value of 1. The matrix, This represents the membership relationship between an element and a set; the process is as follows: Step (2.1.1) Assume a random process The transition probability matrix is ; Partially absorbing random walks are a type of second-order Markov chain where, in each state, there is a certain probability of remaining in the current state or transitioning to the next state, determined by the transition probability. Decide; in, ,in, Represents vertices The degree, S, represents the number of edges connecting vertices in the graph. i,j This represents the value in the i-th row and j-th column of the adjacency matrix S. , Let be a regularized matrix where all values ​​are greater than 0, where This indicates that the elements in the brackets form a diagonal matrix. The calculation formula is ,in Represents the identity matrix. This represents the weighting coefficient, which is adjusted... Adjusting the absorption probability between nodes; Step (2.1.2) will convert the parameter matrix Combined with P, we obtain the formula for calculating convolution weights on the hypergraph. ; Where Q is the parameter matrix used to adjust the transition probabilities in a biased random walk. The Middle Line 1 Column elements The calculation formula is ; in, Represents a node , The shortest distance between, and To adjust the parameters of the roaming strategy.

6. The data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization as described in claim 1 or 2, characterized in that, The process of the third step is as follows: Step (3.1) combines the convolution weight matrix with a traditional hypergraph convolutional network. Based on LightGCN, it discards feature transformation and activation function, simplifies the convolution operation, and defines the convolution operation as... ; in, and This represents the input and output of a single convolution. Represents the adjacency matrix. Representation matrix D Find the inverse; Step (3.2) Substitute the convolution weight matrix Perform hypergraph convolution operation; The formula for single-layer convolution is: ,have The convolution formula for a hypergraph convolutional network with multiple convolutional layers is: ; in, The input matrix represents the embedding matrices of the hypergraph vertices. A multi-channel hypergraph convolutional network is used, so the formula contains... Replace with Hypergraph G1 , G2 , G3 and G4 Convolution weight matrix C1 , C2 , C3 and C4 Calculate the output result , , , ; Where s represents the embedding length; Step (3.3) averages the output of each convolution to obtain the final output of each channel; in, The calculation formula is .

7. The data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization as described in claim 1 or 2, characterized in that, The process of step (4.1) is as follows: Step (4.1.1) Directly use the output results of different channels for loss calculation to obtain the error between the estimated value and the true value of the channel; The formula for calculating the error is as follows: ; Among these, the smaller the error value, the stronger the discriminative features extracted by the channel, and therefore the larger the weight should be. Indicates model parameters, Mashup With API The scoring function, Mashup With API Scoring function; Step (4.1.2) introduces the error from step (4.1.1) into the channel attention mechanism, resulting in a novel channel error attention formula, which is: in, and Both are learnable weight matrices. Represented by natural numbers e An exponential function with base 0; In step (4.2), the formula for calculating the hypergraph vertex representation is: .

8. The data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization as described in claim 1 or 2, characterized in that, The process of the fifth step is as follows: Step (5.1) aggregates the information of the APIs connected to Mashup into Mashup, and then proceeds to step (5.2). The aggregation formula is: ,in, This represents the embedding of the API in the l-th layer convolution on the Mashup-API call graph. This represents the embedding of the l-th convolution in the Mashup API call graph; Step (5.2) aggregates the information of the Mashup connected to the API into the API. If l = L1, then execute step (5.3); otherwise, increment l by 1 and return to step (5.1). in, This represents the total number of convolutional layers, and the aggregation formula is y. a (l+1) =D ii -1 T"y m (l) , in, This is a combined output of a multi-channel hypergraph convolutional network and graph convolution results. The input matrix consists of the embedding matrices of the Mashup. and They represent The degree matrix of T"; Step (5.3) combines the interaction information between Mashups and the interaction information between Mashup-APIs to obtain the embedding representations of Mashups and APIs, where the embedding calculation formula is: , .

9. The data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization as described in claim 1 or 2, characterized in that, The process of the sixth step is as follows: Step (6.1) Calculate the Mashup using the inner product. Similarity between embedding representations obtained based on interaction information between Mashups and interaction information between Mashup-APIs, respectively ; in, Mashup Embedded representations obtained from the interaction information between Mashups Mashup The embedding representation is obtained based on the interaction information between Mashup-APIs. Let represent a similarity scoring function between two vectors, whereby the scoring function is defined as the inner product of the two vectors; Step (6.2) follows the SimCLR format, using InfoNCE as the target of contrastive learning, and defines the formula for calculating the contrastive learning loss as follows: ; in, It is an adjustable temperature parameter.

10. The data service recommendation method integrating dual-scale contrastive learning and multi-objective optimization as described in claim 1 or 2, characterized in that, The process of the seventh step is as follows: Step (7.1) scores the matching degree between the Mashup embeddings and the API embeddings to obtain the top... One matching API; Among them, Mashup With API Match score Through calculation Y g and The inner product is obtained from the product between them; Step (7.2) Calculate the model loss and adjust the model parameters; The loss of the recommendation model is represented by the BPR loss. Positive samples represent API samples actually called by the current Mashup, and negative samples represent API samples not actually called by the current Mashup. The formula for calculating the loss function is as follows: ; in, Mashup With API Match score Mashup With API Match score Represents the logarithmic function. This represents a learnable weight matrix. Indicates model parameters, This indicates a "not belonging" relationship between an element and a set. Step (7.3) combines dual-scale contrastive learning to extend the recommendation task into a multi-objective optimization recommendation task. The Bayesian personalized ranking loss is used as the primary objective, and the contrastive learning loss is used as the secondary objective, resulting in the final objective being... ;in These are hyperparameters that are set manually, i.e., secondary objective weights.

Citation Information

Patent Citations

  • SaaS-oriented Web Api diversity recommendation method fused with restart random walk algorithm

    CN115599980A

  • Hypergraph-based collaborative filtering recommendations

    US20230385607A1