An API recommendation method based on heterogeneous information network meta-path
By building API heterogeneous information network and utilizing metapath embedding methods, the challenge of quickly discovering APIs suitable for Mashup needs in large-scale API databases is solved, and more accurate and efficient API recommendations are achieved.
Patent Information
- Application Number
- CN202210336742.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2042-03-31
AI Technical Summary
In large-scale API databases, there are challenges in quickly discovering and selecting APIs that suit Mashup needs, especially because most APIs use plain text or HTML descriptions, lack of structured language, which increases the difficulty of automatic API discovery. Traditional recommendation methods fail to effectively utilize the relationship between API and Mashup, resulting in insufficient recommendation performance.
Using the API recommendation method based on the metapathic information network, a heterogeneous information network is constructed by obtaining the description information of the API and Mashup, the initial low-dimensional embedding of the API and Mashup is generated, and the context metapath embedding of the API and Mashup interacts with the context metapath, and the neural network model is trained to implement API recommendation.
By building an API heterogeneous information network and utilizing metapath embedding, the complex interaction between API and Mashup can be captured more accurately, and the accuracy and efficiency of API recommendations can be improved.
Smart Images

Figure CN114676331B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of service computing and data analysis, and in particular to an API (Application Programming Interface) recommendation method for heterogeneous information network meta-paths. Background Art
[0002] Web API, or web application programming interface, contains a wide range of functions. Through API interfaces, web applications can implement storage services, message services, computing services, information services, search services, and other capabilities. These capabilities can be used to develop powerful web applications. Although there are many excellent APIs on the Internet, in the face of the rapid development of the information society and the emergence of a large number of additional requirements, the functions of a single API are increasingly unable to cope with complex business needs. Therefore, the development model of creating new applications by mixing different APIs together has been widely welcomed by developers and even ordinary Web 2.0 users. This application generated by API mixing is called Mashup.
[0003] Although Mashup-based application development is already very popular, it is still a challenging problem to quickly discover and select APIs that meet Mashup requirements in a large-scale API database containing a variety of functions. In addition, since most APIs are described in plain text or HTML rather than structured languages, this further increases the difficulty of automatic API discovery. Traditional recommendation methods do not learn the explicit representation of meta-paths in recommendation methods that describe the relationship between APIs and Mashups, and describe auxiliary information as isolated features rather than complete semantic information, so the recommendation performance still needs to be further improved. Summary of the invention
[0004] The purpose of the present invention is to provide an API recommendation method based on heterogeneous information network meta-paths to overcome the problems existing in the prior art.
[0005] In order to achieve the above tasks, the present invention adopts the following technical solutions:
[0006] An API recommendation method based on heterogeneous information network meta-path, comprising:
[0007] Obtain description information of API and its Mashup application, and build a heterogeneous information network around API;
[0008] Generate initial low-dimensional embeddings of APIs and Mashups;
[0009] Generate contextual meta-path embedding based on API interaction with Mashup;
[0010] The initial low-dimensional embedding of API and Mashup and the contextual meta-path embedding based on the interaction between API and Mashup are integrated to train the neural network model and realize API recommendation.
[0011] Furthermore, the description information of the API and its Mashup application, including API name, API category, API provider, Mashup name, and calling relationship between Mashup and API, are merged to obtain a data set named PW; the calling relationship between Mashup and API is regarded as the interaction between the two, and the Mashup-API bipartite graph is constructed around the Mashup and API interaction in the PW data set; categories and providers are selected as supplementary information of the bipartite graph to construct an API heterogeneous information network, and the API heterogeneous information network includes four types of objects and four types of relationships, wherein the four types of objects are also called four types of nodes, including Mashup, API, category, and provider; the four types of relationships include the relationship MA between Mashup and API, the relationship AP between API and provider, the relationship MC between Mashup and category, and the relationship AC between API and category;
[0012] In the heterogeneous information network, when performing meta-path sampling in the API heterogeneous information network, the meta-path containing specific node information is called a path instance.
[0013] Furthermore, generating an initial low-dimensional embedding of the API and the Mashup includes:
[0014] The embeddings of Mashup and API are randomly initialized through two linear transformation layers, and the one-hot vectors u of Mashup and API are input. m 、v a , and obtain the initial low-dimensional embedding e after mapping m 、e a , the formula is as follows:
[0015] e m =W M ·u m
[0016] e a =W A ·v a
[0017] Where W M ∈R m×d and W A ∈R a×d is a randomly initialized feature matrix, m and a are the number of users and APIs respectively, d is the embedding dimension of Mashup and API, and R represents a real number set.
[0018] Furthermore, the generating of contextual meta-path embedding based on API and Mashup interaction includes:
[0019] The initial node expression is obtained through pre-training of the graph representation learning framework;
[0020] According to the selected meta-path, path instances are sampled and meta-path embeddings are generated;
[0021] The meta-path embeddings are merged according to different weight parameters through the attention mechanism to obtain the attention distribution value of the meta-path;
[0022] By normalizing the attention distribution value of the meta-path, we can obtain the contribution of different meta-paths n to the interaction between API and Mashup. Finally, we use the weighted summation method to fuse the meta-path context information according to the weighted contribution to obtain the meta-path-based context embedding representation.
[0023] Furthermore, the pre-training of the graph representation learning framework to obtain the initial node expression includes:
[0024] The connection relationship between nodes in the API heterogeneous information network is input into a graph representation learning framework for pre-training, and finally the pre-trained vector of the node is obtained; in each round of training, three one-hot encoding vectors of any two nodes x, y and the relationship vector r between the nodes x and y after regularization are input, and three initial low-dimensional embeddings are obtained by mapping the feature matrix of the linear transformation layer respectively; after the three initial low-dimensional embeddings are obtained, a Hadamard function is applied to the three vectors, and a linear activation function is applied to the product, and finally the output layer performs a sigmoid nonlinear transformation on the value after the sum of the products, and finally the feature expression of the two nodes x, y after pre-training is output, which is the node pre-trained vector of the API heterogeneous information network.
[0025] Furthermore, sampling the path instances according to the selected meta-path and generating the meta-path embedding includes:
[0026] Perform random walks in the API heterogeneous information network and sample all fixed-length path instances; select path instances based on Mashup and API nodes. When the two endpoints of the path are the specified Mashup and API, select all path instances that also contain these two endpoints as the sampling instance set of the current MA interaction meta-path;
[0027] Calculate and sort the similarity of the Mashup or API nodes in the sampled instance set, and select L path instances;
[0028] The L path instances of the meta-path under the specified interactive MA are merged separately to obtain the meta-path embedding.
[0029] Furthermore, the meta-path embedding is merged according to different weight parameters through the attention mechanism to obtain the attention distribution value, including:
[0030] Initial low-dimensional embedding based on Mashup and API m 、e a , combined with meta-path embedding The attention model structure is constructed through a two-layer linear structure to obtain the attention distribution value of the meta-path The formula is as follows:
[0031]
[0032]
[0033] in, Represents the attention distribution value obtained by the two-layer attention model structure, W1∈R 3d×v , W2∈R v×1 is a randomly initialized feature matrix, d is e m 、e a , The sum of the dimensions of the three input vectors, v is the dimension of the vector, and LeakyReLU(·) is the activation function.
[0034] Furthermore, the initial low-dimensional embedding of the fusion API and Mashup and the contextual meta-path embedding based on the interaction MA between the API and Mashup are integrated to train the model and implement API recommendation, including:
[0035] Given the interaction between the Mashup and the API, the merge operation is defined as follows:
[0036]
[0037] in is a join operation, e P is the contextual embedding representation based on the meta-path, e m and e a They are the initial low-dimensional embeddings of Mashup and API respectively;
[0038] Then the combined vector x m,a Input into the MLP component to implement nonlinear transformation to simulate the complex interaction between Mashup and API, perform model training, and finally obtain the interaction score between Mashup and API Using the loss function J m,aTo optimize the model, after the model training is completed, the model parameters are fixed and API recommendations are made to users.
[0039] A terminal device includes a processor, a memory, and a computer program stored in the memory; when the processor executes the computer program, the steps of the API recommendation method based on the heterogeneous information network meta-path are implemented.
[0040] A computer-readable storage medium stores a computer program; when the computer program is executed by a processor, the steps of the API recommendation method based on heterogeneous information network meta-path are implemented.
[0041] Compared with the prior art, the present invention has the following technical features:
[0042] 1. It can build an API heterogeneous information network; 2. It can use the graph pre-training model to integrate the relationship between nodes and obtain the node representation in the heterogeneous information network; 3. Introduce the meta-path in the API heterogeneous information network to define the different preferences of users for API selection when creating API applications; 4. Use the attention module to distinguish the strength of different user preferences in the meta-path; 5. Use the explicit representation of the meta-path to represent the auxiliary information in a unified space, and perform nonlinear rating prediction modeling for API, Mashup and different preferences of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a flow chart of the method of the present invention;
[0044] Figure 2 This is an example diagram of an API heterogeneous information network;
[0045] Figure 3 This is an example diagram of selecting path instances based on similarity in the present invention. DETAILED DESCRIPTION
[0046] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings. It is necessary to point out here that the following technical solution is only used to further illustrate the present invention and cannot be understood as limiting the scope of protection of the present invention. Some non-essential improvements and adjustments made by technical personnel skilled in the art based on the above-mentioned invention content still fall within the scope of protection of the present invention.
[0047] like Figure 1 As shown, the present invention provides an API recommendation method based on a heterogeneous information network meta-path, comprising the following steps:
[0048] S1, building a heterogeneous information network of APIs: obtaining description information of APIs and their Mashup applications, and building a heterogeneous information network around APIs.
[0049] In this embodiment, the description information of API and Mashup is captured from the network API portal and registration center (Prgrammableweb.com), including API name, API category, API provider, Mashup name, Mashup and API call relationship, etc., and merged to obtain a data set named PW. Furthermore, the call relationship between Mashup and API is regarded as the interaction between the two, and a Mashup-API bipartite graph is constructed around the Mashup and API interaction in the PW data set. The category and provider are selected as the supplementary information of the bipartite graph to construct the following: Figure 2 The API heterogeneous information network shown in the figure consists of four types of objects, also called four types of nodes, (namely, Mashup (M), API (A), Category (C), Provider (P)) and four types of relationships, namely, the relationship MA between Mashup and API, the relationship AP between API and provider, the relationship MC between Mashup and category, and the relationship AC between API and category.
[0050] Among them, the connection relationship (MA) between Mashup and API represents their interactive information, and they form a Mashup-API bipartite graph; on this basis, the connection relationship between Mashup and category, API and category (MC, AC), API and provider (AP) is auxiliary information, and the combined interactive information and auxiliary information form an API heterogeneous information network. Since heterogeneous information networks contain rich high-order structural information, meta-paths (sequences of relationship types between two node types) are widely used as a basic tool for obtaining such information, such as Figure 1 In the example, API: Twitter-Category: Social-API: LinkedIn (ACA), it means APIs belonging to the same category. These three nodes are connected by a line with a length of 3. When performing meta-path sampling in an API heterogeneous information network, the meta-path containing specific node information is called a path instance.
[0051] S2, Generate initial low-dimensional embedding of API and Mashup
[0052] In this embodiment, the embedding of Mashup and API is randomly initialized through two linear transformation layers, and the one-hot vectors u of Mashup and API are input respectively. m 、v a , and obtain the initial low-dimensional embedding e after mapping m 、e a , the formula is as follows:
[0053] e m =W M ·um
[0054] e a =W A ·v a
[0055] Where W M ∈R m×d and W A ∈R a×d is a randomly initialized feature matrix, m and a are the number of users and APIs respectively, d is the embedding dimension of Mashup and API, and R represents a real number set; this step can reduce the computing resource overhead in modeling.
[0056] S3, Generate contextual meta-path embedding based on API interaction with Mashup
[0057] According to the meta-paths of APIs and Mashups in the API heterogeneous information network, different preferences of users for API selection are obtained, and embedding based on the contextual meta-path is generated. In this embodiment, S3 consists of three parts.
[0058] In the first part, we pre-train the graph representation learning framework to obtain the initial node representation. The specific method is:
[0059] The connection relationship between nodes in the training data API heterogeneous information network is input into the graph representation learning framework for pre-training, and finally the pre-trained vector of the node is obtained. In each round of training, three one-hot encoding vectors of the relationship vector r between any two nodes x, y and the regularized nodes x, y are input, and three initial low-dimensional embeddings are obtained by mapping the feature matrix of the linear transformation layer, similar to step S2; further, after obtaining the three initial low-dimensional embeddings, the graph representation learning framework applies a Hadamard function to the three vectors (for example, multiplying the corresponding elements), and then applies a linear activation function to the product. Finally, the output layer performs a sigmoid nonlinear transformation on the value after the sum of the products, and finally outputs the feature expression of the two nodes x, y after pre-training, which is the node pre-training vector of the API heterogeneous information network. In this embodiment, the graph representation learning framework can use HIN2vec.
[0060] The objective function during pre-training is O. For the convenience of calculation, logO, which is proportional to O (∝), is taken as the optimization target. The specific formula is as follows:
[0061]
[0062] where logO x,y,r (x, y, r) measures how well the pre-trained model correctly predicts the training data, specifically
[0063]
[0064] Where L(x, y, r) is used to indicate whether there is a relationship r between x and y. If so, L(x, y, r) is set to 1, otherwise it is set to 0. P(r|x, y) is the probability that the relationship is r when the nodes are x and y.
[0065] This part uses a reasonable training framework and evaluation system to ensure that the node vectors after initial pre-training contain sufficient API heterogeneous information network context semantics and network information, which is crucial for extracting preference information of meta-paths.
[0066] In the second part, according to the selected meta-path (such as the 4 meta-paths in Table 1), the path instances are sampled and the meta-path embedding is generated. The specific method is:
[0067] Random walks are performed in the API heterogeneous information network to sample all fixed-length path instances. The sampled meta-paths in this embodiment are shown in Table 1. After sampling all fixed-length path instances, path instances are selected based on Mashup and API nodes. When the two endpoints of the path are the specified Mashup and API, all path instances that also contain these two endpoints are selected as the sampled instance set of the current MA interaction meta-path.
[0068] Table 1
[0069]
[0070] Furthermore, based on the node pre-training vectors obtained in the first part, similarity calculations are performed on the Mashup or API nodes in the sampled instance set, and the nodes are sorted and L path instances are selected. The specific calculation method is as follows: Figure 3 As shown:
[0071] First, calculate the similarity between two nodes of the same type, Mashup or API, in the path instance. For example, in the meta-path of MCMA, we can calculate the similarity between two identical Mashup nodes M1 and M2 (if the meta-path is MACA or MAPA, calculate the similarity between two identical API nodes A1 and A2). Sort the similarity scores of the same type of nodes in the sampled instance set, and finally retain the L nodes with the highest similarity between Mashup nodes M1 and M2 in the path instance. The specific formula is as follows:
[0072]
[0073] Among them, node1 and node2 are nodes of the same type. The numerator represents the dot product of the node vector node1 and the node vector node2, and the denominator represents the L2 product of the two, that is, the square root of the sum of the squares of all dimensional values.
[0074] Furthermore, the L path instances of the meta-path of the optimal user preference expression under the specified interactive MA are merged to obtain the meta-path embedding. The specific method is:
[0075] For example, a path instance of the meta-path MACA consists of four node pre-trained vectors, namely Mashup, API 1 , Category and API 2 , construct a convolutional neural network CNN, input the node pre-training vectors of the four nodes into CNN in the form of node embedding matrix, and obtain the path instance embedding h mapped in the low-dimensional vector space p , the specific formula is as follows:
[0076] h p =CNN(X p ;θ)
[0077] Among them, X p ∈R s×d is the node embedding matrix of the path instance, s is the number of nodes of the path instance, d is the embedding dimension of the pre-trained node; θ is all the relevant parameters in the convolutional layer; the L path instance embeddings under the meta-path MACA are obtained After that, where l = 1, 2, ..., L; the MACA meta-path embedding under MA interaction is obtained through the maximum pooling operation
[0078]
[0079] Among them, max-pooling is the maximum pooling operation, and CNN() represents the convolutional neural network.
[0080] This part innovatively uses meta-path embedding representation as the basis for similarity calculation in API heterogeneous information networks, which is more interpretable than traditional matrix decomposition.
[0081] In the third part, the meta-path embedding is merged according to different weight parameters through the attention mechanism. The specific method is:
[0082] First, input the vector representation of the Mashup and API obtained by S2 and the meta-path embedding obtained by S3 n is the meta-path type (MACA, MAMA, MAPA, MCMA), and the attention model structure is constructed through a two-layer linear structure to obtain the attention distribution value of the meta-path The formula is as follows:
[0083]
[0084]
[0085] in, Represents the attention distribution value obtained by the two-layer attention model structure, W1∈R 3d×v , W2∈R v×1 is a randomly initialized feature matrix, d is e m 、e a , The sum of the dimensions of the three input vectors, v is the dimension of, e m and e a are the initial low-dimensional embeddings of Mashup and API respectively, and LeakyReLU(·) is the activation function.
[0086] Furthermore, the attention distribution value of the meta-path is normalized and calculated by the SoftMax function to obtain the contribution of different meta-paths n to the MA interaction. The formula is as follows:
[0087]
[0088] Among them, exp is an exponential function with the natural constant e as the base. Finally, the meta-path context information is fused according to the weight contribution through the weight summation method to obtain the meta-path-based context embedding representation:
[0089]
[0090] This part innovatively introduces the attention mechanism in the calculation of the contribution scores of multiple meta-paths, which better captures the user's selection preferences and reflects them in the contextual embedding representation of the meta-path, making subsequent API recommendations more accurate.
[0091] S4, integrates the initial low-dimensional embedding of API and Mashup and the contextual meta-path embedding based on the interaction MA between API and Mashup, trains the model, and implements API recommendation.
[0092] In this embodiment, given the interaction between Mashup and API, the embedding of Mashup and API and the embedding representation of the contextual meta-path of the interaction between them are obtained through steps S2 and S3. We merge these three embeddings into the vector representation x of MA interaction in a unified vector space. m,a The merge operation is defined as follows:
[0093]
[0094] in is a join operation, e P is the contextual embedding representation based on the meta-path, e m and e a They are the initial low-dimensional embeddings of Mashup and API respectively.
[0095] Furthermore, the merged vector x m,a Input into the MLP component to implement nonlinear transformation to simulate the complex interaction between Mashup and API, perform model training, and finally obtain the interaction score between Mashup and API The specific formula is as follows:
[0096]
[0097] Among them, MLP(·) is a nonlinear transformation component. When making rating predictions, the loss function J is used m,a To optimize the model, the specific formula is:
[0098]
[0099] where θ neg is the negative sampling probability.
[0100] Finally, after the model training is completed, the model parameters are fixed and API recommendations are made to users.
[0101] In actual application, for a mashup to be completed by a user, firstly, the input vector of the mashup and the input vectors of all candidate APIs are obtained through the previous step S2; further, through step S3, the context meta-path embedding between the mashup and each candidate API is calculated; finally, the mashup, API and context meta-path vectors are merged into a representation x m,a , calculate the interaction score between Mashup and each API Recommendations are made by sorting all interaction scores and outputting an API recommendation list from high to low.
[0102] In this embodiment, the attention mechanism training method is compared and analyzed by using the A average recall rate (Recall), normalized discounted cumulative gain (NDCG) and precision evaluation indicators, where PHRec-avg is the fusion of four meta-paths according to the average contribution to generate the context embedding representation of the meta-path, and PHRec-att is the third part of S3, which is the context embedding representation generated by the attention mechanism according to different weight parameters. The results under different training methods are shown in Table 2.
[0103] Table 2 Performance comparison of fusion meta-path methods
[0104]
[0105] Under the API recommendation evaluation indicators obtained by training under the above two training strategies, the recall rate, normalized cumulative loss gain and accuracy rate are improved by 1.34%, 0.57% and 1.29% respectively. According to the data in Table 2, it can be seen that distinguishing the weight scores of different meta-paths helps to improve the recommendation performance compared with treating all meta-paths as equally important.
[0106] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application 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 make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An API recommendation method based on heterogeneous information network meta-path, characterized in that: include: Obtain description information of API and its Mashup application, and build a heterogeneous information network around API; Generate initial low-dimensional embeddings of APIs and Mashups; Generate contextual meta-path embedding based on API interaction with Mashup; The initial low-dimensional embedding of API and Mashup is integrated with the contextual meta-path embedding based on the interaction between API and Mashup to train the neural network model and implement API recommendation. The generation of contextual meta-path embedding based on API interaction with Mashup includes: The initial node expression is obtained through pre-training of the graph representation learning framework; According to the selected meta-path, path instances are sampled and meta-path embeddings are generated; The meta-path embeddings are merged according to different weight parameters through the attention mechanism to obtain the attention distribution value of the meta-path; By normalizing the attention distribution value of the meta-path, we can get the contribution of different meta-paths n to the interaction between API and Mashup. Finally, we use the weighted summation method to fuse the meta-path context information according to the weighted contribution to get the contextual embedding representation based on the meta-path. The initial node expression is obtained by pre-training the graph representation learning framework, including: The connection relationship between nodes in the API heterogeneous information network is input into a graph representation learning framework for pre-training, and finally the pre-trained vector of the node is obtained; in each round of training, three one-hot encoding vectors of any two nodes x, y and the relationship vector r between the nodes x and y after regularization are input, and three initial low-dimensional embeddings are obtained by mapping the feature matrix of the linear transformation layer respectively; after the three initial low-dimensional embeddings are obtained, a Hadamard function is applied to the three vectors, and a linear activation function is applied to the product, and finally the output layer performs a sigmoid nonlinear transformation on the value after the sum of the products, and finally the feature expression of the two nodes x and y after pre-training is output, which is the node pre-trained vector of the API heterogeneous information network.
2. The API recommendation method based on heterogeneous information network meta-path according to claim 1 is characterized in that: The description information of the API and its Mashup application, including API name, API category, API provider, Mashup name, and the calling relationship between Mashup and API, are combined to obtain a data set named PW; the calling relationship between Mashup and API is regarded as the interaction between the two, and the Mashup-API part is constructed around the Mashup and API interaction in the PW data set; The API heterogeneous information network is constructed by selecting categories and providers as supplementary information of the bipartite graph. The API heterogeneous information network includes four types of objects and four types of relationships, wherein the four types of objects are also called four types of nodes, including Mashup, API, category, and provider; the four types of relationships include the relationship MA between Mashup and API, the relationship AP between API and provider, the relationship MC between Mashup and category, and the relationship AC between API and category; In the heterogeneous information network, when performing meta-path sampling in the API heterogeneous information network, the meta-path containing specific node information is called a path instance.
3. The API recommendation method based on heterogeneous information network meta-path according to claim 1 is characterized in that: The generation of the initial low-dimensional embedding of the API and Mashup includes: The embeddings of Mashup and API are randomly initialized through two linear transformation layers, and the one-hot vectors u of Mashup and API are input. m 、v a , and obtain the initial low-dimensional embedding e after mapping m 、e a , the formula is as follows: have been m =W M u m e a JW A ·v a Where W M ∈R m×d and W A ∈R a×d is a randomly initialized feature matrix, m and a are the number of users and APIs respectively, d is the embedding dimension of Mashup and API, and R represents a real number set.
4. The API recommendation method based on heterogeneous information network meta-path according to claim 1 is characterized in that: The method of sampling path instances according to the selected meta-path and generating meta-path embedding includes: Perform random walks in the API heterogeneous information network and sample all fixed-length path instances; select path instances based on Mashup and API nodes. When the two endpoints of the path are the specified Mashup and API, select all path instances that also contain these two endpoints as the sampling instance set of the current MA interaction meta-path; Calculate and sort the similarity of the Mashup or API nodes in the sampled instance set, and select L path instances; The L path instances of the meta-path under the specified interactive MA are merged separately to obtain the meta-path embedding.
5. The API recommendation method based on heterogeneous information network meta-path according to claim 1 is characterized in that: The method of merging meta-path embeddings according to different weight parameters through the attention mechanism to obtain the attention distribution value includes: Initial low-dimensional embedding based on Mashup and API m 、e a , combined with meta-path embedding The attention model structure is constructed through a two-layer linear structure to obtain the attention distribution value of the meta-path The formula is as follows: in, Represents the attention distribution value obtained by the two-layer attention model structure, W1∈R 3d×v , W2∈R v ×1 is a randomly initialized feature matrix, d is e m 、e a , The sum of the dimensions of the three input vectors, v is the dimension of the vector, and LeakyReLU(·) is the activation function.
6. The API recommendation method based on heterogeneous information network meta-path according to claim 1 is characterized in that: The method integrates the initial low-dimensional embedding of API and Mashup and the contextual meta-path embedding based on the interaction MA between API and Mashup, trains the model, and implements API recommendation, including: Given the interaction between the Mashup and the API, the merge operation is defined as follows: x m,a =and m ⊕e P ⊕e a Where ⊕ is the join operation, e P is the contextual embedding representation based on the meta-path, e m and e a They are the initial low-dimensional embeddings of Mashup and API respectively; Then the combined vector x m,a Input into the MLP component to implement nonlinear transformation to simulate the complex interaction between Mashup and API, perform model training, and finally obtain the interaction score between Mashup and API Using the loss function J m,a To optimize the model, after the model training is completed, the model parameters are fixed and API recommendations are made to users.
7. A terminal device, comprising a processor, a memory and a computer program stored in the memory; characterized in that: When the processor executes the computer program, it implements the API recommendation method based on heterogeneous information network meta-path according to any one of claims 1 to 6.
8. A computer-readable storage medium, wherein a computer program is stored in the medium; characterized in that: When the computer program is executed by a processor, the API recommendation method based on heterogeneous information network meta-path according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Method and apparatus for providing an instantiated industrial semantic model for an industrial infrastructure
CN110275875A
Android malicious application detection method and system based on heterogeneous network
CN112487421A