Service data loss function positive and negative example sampling and re-recommendation method for web3.0
The service data loss function sampling method improves Web3.0 service recommendations by optimizing the convergence process to achieve diverse and correlated results, addressing the limitations of existing technologies.
Patent Information
- Application Number
- JP2023216478
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2023-11-13
- Filing Date
- 2023-12-22
- Publication Date
- 2025-09-25
- Estimated Expiration
- 2043-12-22
AI Technical Summary
Existing service recommendation technologies in Web3.0 lack diversity and correlation in recommendation results, necessitating improved methods to optimize the recommendation process.
A service data loss function positive and negative example sampling method is employed to sample and optimize the convergence process, using functional domain and description document information to generate diverse and correlated re-recommendation results through determinant point process re-sorting.
The method enhances service recommendation quality by optimizing the model with diverse and correlated results without additional data, balancing diversity and correlation effectively.
Smart Images

Figure 0007743970000212 
Figure 0007743970000213 
Figure 0007743970000001
Abstract
Description
[Technical Field]
[0001] The present invention relates to a service data loss function positive and negative example sampling and re-recommendation method for web 3.0. [Background technology]
[0002] The combination of technologies such as service computing, big data, blockchain, and Internet of Mobility across different fields has propelled web technology into the "3.0 era." While the evolution of web technology has brought about massive amounts of data, further driving the development of information technology, it has also led to a certain increase in invalid resources and noisy data on the Internet. Therefore, in the field of service computing, how to quickly and accurately find API services that meet developers' needs from these massive amounts of data has become a major challenge.
[0003] In this context, service recommendation technology has attracted widespread attention. Traditional service recommendation technologies use collaborative filtering to calculate user and service similarities to recommend services. For example, patent number 202011122955.6, titled "Service Information Recommendation Apparatus and Method Based on Collaborative Filtering Algorithm," proposes a service recommendation method that uses a GRU neural network to screen potential users and calculates their similarity by combining the Pearson correlation coefficient. Patent number 201710211954.0, titled "Collaborative Filtering Method for Web Service Recommendation," uses service quality information to estimate user preferences and utilizes a top-k algorithm to find API services that match the user's preferences. Guo Yanhong and colleagues at the Institute of System Engineering, Dalian University of Technology, proposed a sparse matrix-based personalized improvement policy to mitigate the data sparsity issue in the service recommendation process by restricting relationships with low similarity between users.
[0004] Most of the above recommendation methods achieve service recommendation by modifying the recommendation algorithm or recommendation model, but do not make any innovative improvements to the service recommendation process. From the perspective of the recommendation process, all of the above recommendation methods belong to single-recommendation methods, and the diversity and correlation of the recommendation results need to be improved. Re-recommendation technology can optimize single-recommendation results using prior information such as service combination, service functions, and service structure, and the generated re-recommendation results have high service recommendation quality. Re-recommendation technology has been widely applied in fields such as social networks, e-commerce sales, and streaming platforms, but in the field of service computing, there is currently little research and application on re-recommendation. Summary of the Invention [Problem to be solved by the invention]
[0005] In order to overcome the shortcomings of the prior art, balance the diversity and correlation of service recommendation results, and improve the quality of service recommendation, the present invention provides an efficient and versatile service data loss function positive and negative example sampling and re-recommendation method for Web3.0, which first uses a loss function positive and negative example sampling rule to sample service data and obtain loss function positive and negative examples, then uses the loss function positive and negative examples to form diversity sample pairs and optimize the convergence process of the loss function, and finally generates re-recommendation results and sorts them using a method based on determinant point process. [Means for solving the problem]
[0006] The technical solutions used in the present invention are as follows:
[0007] A service data loss function positive and negative example sampling and re-recommendation method for web 3.0, In step 1, the loss function positive and negative example sampling rules are designed based on the functional domain and description document information of the API service in the service data. The process is as follows: 1.1 Service data: refers to the data used by the service recommendation model in the training process, including API services, functional areas, service combinations, call sequences, and description documents; 1.2 API Service: An Application Programming Interface (API), represented by the symbol a, 1.3 Functional field: The functional type and application field to which the API service belongs, represented by the symbol c, is the prior information of the API service. 1.4 Service Combination: Combining two or more API services to form a new API service, represented by the symbol m, is the prior information of the API service. 1.5 Call Sequence: A sequence of API services accessed by a user, ordered by time, represented by the symbol s. 1.6 Description document: Text data describing the functional area and interface information of the API service, represented by the symbol d, is the preliminary information of the API service. 1.7 Positive and negative examples of the loss function: In the convergence process of the loss function, the sampled service data is called the positive examples of the loss function, and the unsampled service data is called the negative examples of the loss function, and they are denoted by the symbol l. + and - Each loss function positive example has multiple corresponding loss function negative examples, and the combination of both is called a loss function positive / negative example. 1.8 Loss function positive and negative example sampling rule: Select the APIs directly called by users and indirectly called by service combinations as loss function positive examples from the service data. For other service data, first obtain the similarity using the loss function positive example similarity calculation method based on prior information, and then select the service data with high similarity as loss function negative examples. In step 2, the service data is sampled for positive and negative loss function examples according to the loss function positive and negative example sampling rule created in step 1.8, and the number of loss function negative examples is limited using the similarity threshold ζ; In step 3, a diversity sample pair is constructed using the positive and negative examples of the loss function, and the convergence process of the loss function in the service recommendation model is optimized to obtain a diverse service recommendation result set; In step 4, the initial service recommendation result set and the diversified service recommendation result set are integrated to generate re-recommendation results, and finally, the determinant point process method is used to re-sort the re-recommendation results.
[0008] Preferably, in the above 1.8, the calculation process of the loss function positive and negative example similarity based on prior information is specifically as follows: 1.8.1 Loss Function We arbitrarily select one API service that is a positive example and + The functional area and description document to which each belongs are denoted by the symbol c + and d + It is expressed as 1.8.2 Arbitrarily select one API service from the other service data, denoted as a, and denote the functional area and description document to which it belongs by the symbols c and d, respectively; 1.8.3d + and d are input to the pre-trained language model, and the result is a + and a are the embedding vectors of a, and are symbolized as e a+ and the symbol e a The pre-trained language model is a commonly used deep learning method that can convert text data into word vectors. 1.8.4 e a+ and e a Calculating the cosine distance between: e a+ Transpose vector of and e a Multiply by and divide by the magnitude of both, and write the result as
number
number
number
number
number
number
number
number
[0009] Furthermore, the process of step 2 is as follows: 2.1 Loss function positive and negative example sampling: In the training process of the service recommendation model, the service data used in the loss function is extracted and classified according to the loss function positive and negative example sampling rules. This can be divided into two processes: loss function positive example sampling and loss function negative example sampling. The processes are as described in 2.2 to 2.4. 2.2 Loss function positive example sampling: According to the loss function positive and negative example sampling rules, select loss function positive examples from the service data. Preferably, in 2.2, the loss function positive example sampling process is as follows: 2.2.1 Loss Function We define a set of positive examples and denote it by the symbol set + It is expressed as 2.2.2 Traverse the API services in the service data and find the API service taken for the i-th time as a i year, 2.2.3 Traverse the call sequence in the service data and define the call sequence taken at the jth time as s j year, 2.2.4 s j ni a i If it contains a i is called directly, and a i The loss function positive examples
number
number
[0010] 2.3 Loss function negative example sampling: According to the loss function positive and negative example sampling rules, select loss function negative examples from the service data. Preferably, in 2.3, the loss function negative example sampling process is as follows: 2.3.1 Extract all API services in the service data and construct set A; 2.3.2 Set A and loss function positive example set + The difference set is defined as the loss function negative example candidate set, denoted by preSet. 2.3.3 Loss function positive example set + and the i-th loss function positive example is denoted by the symbol
number
number
number
number
number
number
number
[0011] 2.4 Limiting the number of negative examples of loss function: after obtaining the negative examples of loss function in 2.3, further limit the number of negative examples of loss function by the similarity threshold ζ. Preferably, in 2.4, the limiting process of the number of negative examples of loss function is as follows: 2.4.1 Define the similarity threshold ζ to be used to control the number of negative examples in the loss function, 2.4.2 Loss function negative example constraint set
number
number
number
number
number
number
number
number
number
number
number
number
number
number
number
number
[0012] Furthermore, the process of step 3 is as follows: 3.1 Diversity sample pair construction: The sample pair obtained by combining the loss function positive examples and the loss function negative examples after limiting the number can increase the diversity of the service recommendation results compared with the general sample pair. Preferably, in 3.1, the diversity sample pair construction process is as follows: 3.1.1 Define the diversity sample pair set multiSet, 3.1.2 Loss function positive example set + traverses the i-th loss function positive example
number
number
number
number
number
number
number
number
number
number
number
[0013] 3.2 Defining the initial service recommendation result set: Based on the user query, the service recommendation model gives a set of initial API service recommendations, denoted by R d The service recommendation model is a conventional model that can learn and mine service data and provide service recommendation results based on user queries. This model is constructed using methods based on collaborative filtering and neural networks. 3.3 Optimization of the loss function convergence process: First, obtain a diversity sample pair based on 3.1, then replace the original data used in the loss function in 3.1 with the diversity sample pair, and retrain the model obtained in 3.2; 3.4 Diversified service recommendation result set: After 3.3, we define the set of recommended API services given by the service recommendation model as the diversified service recommendation result set, denoted by R m It is expressed as:
[0014] Furthermore, the process of step 4 is as follows: 4.1 Re-recommendation result: In order to improve the recommendation quality, after optimizing the service recommendation model, loss function, or data sample, we make two or more recommendations. The result is called the re-recommendation result, denoted by R. c It is expressed as 4.2 Integration of the initial service recommendation result set and the diversified recommendation result set: The initial service recommendation result set and the diversified recommendation result set are integrated according to the functional field and service combination. In the above 4.2, the integration process is as follows: 4.2.1 Re-recommendation result set R c Define 4.2.2 Define the correlation hyperparameter θ, 4.2.3 Define the diversity hyperparameter η, 4.2.4 Input the user's query into the service recommendation model to generate the initial service recommendation result set R d Give 4.2.5 Using Step 3, the diversified service recommendation result set R m Obtained, 4.2.6 R d traverses the i-th API service and returns a i year, 4.2.7 R m traverses the jth API service and returns the jth API service to a j year, 4.2.8 a i and a j If the same, a i R c and jump to 4.2.7, 4.2.9 a i and a j When the functional areas of both are different, i and c jand the symbol M i In a i represents the set of service combinations corresponding to M j In a j represents the set of service combinations corresponding to 4.2.10 c i and c j Calculate the Jaccard similarity coefficient between and and compare it with η. If the Jaccard similarity coefficient is smaller than η, jump to 4.2.7. 4.2.11 M i and M j Calculate the Jaccard similarity coefficient between θ and θ, and compare it with θ. If the Jaccard similarity coefficient is smaller than θ, jump to 4.2.7. 4.2.12 a i and a j R c Add to 4.2.13a j R m If it is the last API service in 4.2.14a i R d If it is the last API service in 4.2.15 R c and 4.3 Re-sorting of recommendation results: Using the score matrix and similarity matrix, we calculate the determinant point process to re-sort the recommendation results, balancing the diversity and correlation of the recommendation results. Preferably, in 4.3, the process of rearranging the re-recommendation results using a determinant point process is as follows: 4.3.1 Define the similarity matrix, whose row and column elements are the similarities of the recommendation services, and denoted by Q. 4.3.2 Define a score matrix, whose row and column elements are the recommendation scores given by the service recommendation model, and denoted by the symbol P. 4.3.3 Define the kernel matrix, denoted by the symbol L. The kernel matrix is obtained by performing matrix operation on the score matrix and the similarity matrix. The operation formula is L=P·Q·P, where the symbol "·" represents matrix multiplication and the symbol "=" represents matrix substitution. 4.3.4 Define the balance coefficient, which represents the degree of balance between diversity and correlation of re-recommendation results, and is denoted by the symbol σ. 4.3.5 Re-recommended result set R using 4.2 c We obtain the symbol
number
number
number
number
number
number
number
number
[0015] The beneficial effects of the present invention are as follows: (1) It is possible to optimize a service recommendation model by sampling positive and negative examples of a loss function based on existing service data without relying on additional data; (2) It is highly efficient, and the amount of calculation required to rearrange the re-recommendation results using a determinant point process is small; and (3) It has good versatility, and can be used in hybrid with conventional service recommendation models to generate re-recommendation results that are both diverse and correlated. [Brief explanation of the drawings]
[0016] [Figure 1] FIG. 10 is an explanatory diagram of processes such as sampling positive and negative examples of loss functions and re-sorting of re-recommendation results in the present invention. [Figure 2] FIG. 10 is an explanatory diagram of experimental results of actual service data in the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0017] The present invention will now be further described in conjunction with the following specification, drawings and examples.
[0018] Referring to FIG. 1 and FIG. 2, a service data loss function positive and negative example sampling and re-recommendation method for web 3.0, In step 1, the loss function positive and negative example sampling rules are designed based on the functional domain and description document information of the API service in the service data. The process is as follows: 1.1 Service data: refers to the data used by the service recommendation model in the training process, including API services, functional areas, service combinations, call sequences, and description documents; 1.2 API Service: An Application Programming Interface (API), represented by the symbol a, 1.3 Functional field: The functional type and application field to which the API service belongs, represented by the symbol c, is the prior information of the API service. 1.4 Service Combination: Combining two or more API services to form a new API service, represented by the symbol m, is the prior information of the API service. 1.5 Call Sequence: A sequence of API services accessed by a user, ordered by time, represented by the symbol s. 1.6 Description document: Text data describing the functional area and interface information of the API service, represented by the symbol d, is the preliminary information of the API service. 1.7 Positive and negative examples of the loss function: In the convergence process of the loss function, the sampled service data is called the positive examples of the loss function, and the unsampled service data is called the negative examples of the loss function, and they are denoted by the symbol l. + and - Each loss function positive example has multiple corresponding loss function negative examples, and the combination of both is called a loss function positive / negative example. 1.8 Loss function positive and negative example sampling rule: The APIs directly called by users and indirectly called by service combinations are selected as loss function positive examples from the service data. For other service data, the similarity is first obtained using a loss function positive example similarity calculation method based on prior information, and then the service data with high similarity is selected as loss function negative examples. In 1.8, the calculation process of loss function positive and negative example similarity based on prior information is as follows: 1.8.1 Loss Function We arbitrarily select one API service that is a positive example and + The functional area and description document to which each belongs are denoted by the symbol c + and d + It is expressed as 1.8.2 Arbitrarily select one API service from the other service data, denoted as a, and denote the functional area and description document to which it belongs by the symbols c and d, respectively; 1.8.3d + and d are input to the pre-trained language model, and the result is a + and a are the embedding vectors of a, and are symbolized as e a+ and the symbol e a The pre-trained language model is a commonly used deep learning method that can convert text data into word vectors, such as the BERT model. 1.8.4 e a+ and e a Calculating the cosine distance between: e a+ Transpose vector of and e a Multiply by and divide by the magnitude of both, and write the result as
number
number
number
number
number
number
number
number
[0019] In step 2, according to the loss function positive and negative example sampling rules created in step 1.8, the service data is sampled for loss function positive and negative examples, and the number of loss function negative examples is limited using the similarity threshold ζ. The process is as follows: 2.1 Loss function positive and negative example sampling: In the training process of the service recommendation model, the service data used in the loss function is extracted and classified according to the loss function positive and negative example sampling rules. This can be divided into two processes: loss function positive example sampling and loss function negative example sampling. The specific steps are as described in 2.2 to 2.4. 2.2 Loss function positive example sampling: According to the loss function positive and negative example sampling rules, loss function positive examples are selected from the service data. In 2.2 above, the loss function positive example sampling process is as follows: 2.2.1 Loss Function We define a set of positive examples and denote it by the symbol set + It is expressed as 2.2.2 Traverse the API services in the service data and find the API service taken for the i-th time as a i year, 2.2.3 Traverse the call sequence in the service data and define the call sequence taken at the jth time as s j year, 2.2.4 s j ni a i If it contains a i is called directly, and a i The loss function positive examples
number
number
[0020] 2.3 Loss function negative example sampling: According to the loss function positive and negative example sampling rules, loss function negative examples are selected from the service data. In 2.3 above, the process of loss function negative example sampling is as follows: 2.3.1 Extract all API services in the service data and construct set A; 2.3.2 Set A and loss function positive example set + The difference set is defined as the loss function negative example candidate set, denoted by preSet. 2.3.3 Loss function positive example set + and the i-th loss function positive example is denoted by the symbol
number
number
number
number
number
number
number
[0021] 2.4 Limiting the number of negative examples of loss function: After obtaining the negative examples of loss function in 2.3, the number of negative examples of loss function is further limited by the similarity threshold ζ. In 2.4, the limiting process of the number of negative examples of loss function is as follows: 2.4.1 Define the similarity threshold ζ to be used to control the number of negative examples in the loss function, 2.4.2 Loss function negative example constraint set
number
number
number
number
number
number
number
number
number
number
number
number
number
number
number
number
[0022] In step 3, the positive and negative examples of the loss function are used to construct a diversity sample pair, and the convergence process of the loss function in the service recommendation model is optimized to obtain a diversity service recommendation result set. The process is shown in Figure 1(a) and Figure 1(a). The process is as follows: 3.1 Diversity sample pair construction: The sample pair obtained by combining the loss function positive examples and the loss function negative examples after limiting the number can increase the diversity of the service recommendation results compared to the general sample pair. In 3.1, the process of constructing the diversity sample pair is as follows: 3.1.1 Define the diversity sample pair set multiSet, 3.1.2 Loss function positive example set + traverses the i-th loss function positive example
number
number
number
number
number
number
number
number
number
number
number
[0023] 3.2 Defining the initial service recommendation result set: Based on the user query, the service recommendation model gives a set of initial API service recommendations, denoted by R d In this regard, the service recommendation model refers to a model that can learn and mine service data and provide service recommendation results based on user queries. Currently, in this research field, there are multiple recommendation models available for selection, such as a clustering-based service recommendation model, a theme modeling-based service recommendation model, etc.
[0024] 3.3 Optimization of the loss function convergence process: First, obtain a diversity sample pair based on 3.1, then replace the original data used in the loss function in 3.1 with the diversity sample pair, and retrain the model obtained in 3.2. The pair-wise Bayesian Personalized Ranking loss function (BPR) can be used as the object to be optimized. 3.4 Diversified service recommendation result set: After 3.3, we define the set of recommended API services given by the service recommendation model as the diversified service recommendation result set, denoted by R m It is expressed as Step 4: The initial service recommendation result set and the diversified service recommendation result set are integrated to generate re-recommendation results, and finally, the re-recommendation results are re-sorted using the determinant point process method, as shown in Figure 1(c), and the process is as follows: 4.1 Re-recommendation result: In order to improve the recommendation quality, after optimizing the service recommendation model, loss function, or data sample, we make two or more recommendations. The result is called the re-recommendation result, denoted by R. c It is expressed as 4.2 Integration of the initial service recommendation result set and the diversified recommendation result set: The initial service recommendation result set and the diversified recommendation result set are integrated according to the functional field and service combination. In the above 4.2, the integration process is as follows: 4.2.1 Re-recommendation result set R c Define 4.2.2 Define the correlation hyperparameter θ, 4.2.3 Define the diversity hyperparameter η, 4.2.4 Input the user's query into the service recommendation model to generate the initial service recommendation result set R d Give 4.2.5 Using Step 3, the diversified service recommendation result set R m Obtained, 4.2.6 R d traverses the i-th API service and returns a i year, 4.2.7 R m traverses the jth API service and returns the jth API service to a j year, 4.2.8 a i and a j If the same, a i R c and jump to 4.2.7, 4.2.9 a i and a j When the functional areas of both are different, i and c j and the symbol M i In a i represents the set of service combinations corresponding to M j In a j represents the set of service combinations corresponding to 4.2.10 c i and c j Calculate the Jaccard similarity coefficient between and and compare it with η. If the Jaccard similarity coefficient is smaller than η, jump to 4.2.7. 4.2.11 M i and M j Calculate the Jaccard similarity coefficient between θ and θ, and compare it with θ. If the Jaccard similarity coefficient is smaller than θ, jump to 4.2.7. 4.2.12 a i and a j R c Add to 4.2.13a j R m If it is the last API service in 4.2.14a i R d If it is the last API service in 4.2.15 R c and 4.3 Re-sorting of re-recommendation results: Using the score matrix and the similarity matrix, calculate the determinant point process to re-sort the re-recommendation results, and balance the diversity and correlation of the recommendation results. In the above 4.3, the process of re-sorting the re-recommendation results using the determinant point process is as follows: 4.3.1 Define the similarity matrix, whose row and column elements are the similarities of the recommendation services, and denoted by Q. 4.3.2 Define a score matrix, whose row and column elements are the recommendation scores given by the service recommendation model, and denoted by the symbol P. 4.3.3 Define the kernel matrix, denoted by the symbol L. The kernel matrix is obtained by performing matrix operation on the score matrix and the similarity matrix. The operation formula is L=P·Q·P, where the symbol "·" represents matrix multiplication and the symbol "=" represents matrix substitution. 4.3.4 Define the balance coefficient, which represents the degree of balance between diversity and correlation of re-recommendation results, and is denoted by the symbol σ. 4.3.5 Re-recommended result set R using 4.2 c We obtain the symbol
number
number
number
number
number
number
number
number
[0025] Below, we will analyze the actual effects of the invention using specific service data.
[0026] 1. The service data used includes 1423 service combinations, 1032 RESTful services, and 324 pairs of service call sequences, and is obtained from the Internet based on crawler technology.
[0027] 2. The hyperparameters in this method are set as follows: Embedding vector e a+ and e aThe feature dimension of is set to 64, the similarity threshold ζ is selected from [0.2, 0.25, 0.3, 0.35, 0.4], and the correlation hyperparameter θ and diversity hyperparameter η are set to 0.1 and 0.3, respectively.
[0028] 3. Four representative service recommendation methods are selected as comparison methods.
[0029] 3.1 Service-KNN method: A typical service recommendation method based on similarity.
[0030] 3.2 MMR Method: Maximum Boundary Correlation Method.
[0031] 3.3 AFM model: a service recommendation model based on factorization machine.
[0032] 3.4 NGCF model: a service recommendation method based on collaborative filtering.
[0033] 4. Hit rate is used to evaluate the accuracy of service recommendation, and the calculation formula is as follows:
number
[0034] 5. The average distance within the list is used to indicate the degree of diversification of the service recommendation results, and the calculation formula is as follows:
number
number
[0035] 6. Randomly select 80% of the service data for training, and the other 20% for testing. The experimental results are shown in Figure 2.
[0036] 7. As can be seen from analyzing Figure 2, the present invention significantly improves both the recommendation accuracy and recommendation diversity compared to the service-KNN method, the AFM model, and the NGCF model. The recommendation diversity of the MMR method is slightly higher than that of the present invention, but the present invention has a greater advantage in recommendation accuracy.
[0037] The contents described in the examples of this specification are merely a list of implementation forms of the concept of the invention and are merely for the purpose of explaining applications. The scope of protection of the present invention is not limited to the specific forms described in the examples, and the scope of protection of the present invention also extends to equivalent technical means that a person skilled in the art can think of based on the concept of the present invention.
[0038] (Addendum) (Appendix 1) A service data loss function positive and negative example sampling and re-recommendation method for web 3.0, In step 1, the loss function positive and negative example sampling rules are designed based on the functional domain and description document information of the API service in the service data. The process is as follows: 1.1 Service data: refers to the data used by the service recommendation model in the training process, including API services, functional areas, service combinations, call sequences, and description documents; 1.2 API Service: Application Program Interface API, represented by the symbol a, 1.3 Functional field: The functional type and application field to which the API service belongs, represented by the symbol c, is the prior information of the API service. 1.4 Service Combination: Combining two or more API services to form a new API service, represented by the symbol m, is the prior information of the API service. 1.5 Call Sequence: A sequence of API services accessed by a user, ordered by time, represented by the symbol s. 1.6 Description document: Text data describing the functional area and interface information of the API service, represented by the symbol d, is the preliminary information of the API service. 1.7 Positive and negative examples of the loss function: In the convergence process of the loss function, the sampled service data is called the positive examples of the loss function, and the unsampled service data is called the negative examples of the loss function, and they are denoted by the symbol l. + and - Each loss function positive example has multiple corresponding loss function negative examples, and the combination of both is called a loss function positive / negative example. 1.8 Loss function positive and negative example sampling rule: Select the APIs directly called by users and indirectly called by service combinations as loss function positive examples from the service data. For other service data, first obtain the similarity using the loss function positive example similarity calculation method based on prior information, and then select the service data with high similarity as loss function negative examples. In step 2, the service data is sampled for positive and negative loss function examples according to the loss function positive and negative example sampling rule created in step 1.8, and the number of loss function negative examples is limited using the similarity threshold ζ; In step 3, a diversity sample pair is constructed using the positive and negative examples of the loss function, and the convergence process of the loss function in the service recommendation model is optimized to obtain a diverse service recommendation result set; In step 4, the initial service recommendation result set and the diversified service recommendation result set are integrated to generate re-recommendation results, and finally, the re-recommendation results are re-sorted using a determinant point process method.
[0039] (Appendix 2) In the above 1.8, the calculation process of the loss function positive and negative example similarity based on prior information is as follows: 1.8.1 Loss Function We arbitrarily select one API service that is a positive example and + The functional area and description document to which each belongs are denoted by the symbol c + and d + It is expressed as 1.8.2 Arbitrarily select one API service from the other service data, denoted as a, and denote the functional area and description document to which it belongs by the symbols c and d, respectively; 1.8.3d + and d are input to the pre-trained language model, and the result is a + and a are the embedding vectors of a, and are symbolized as e a+ and the symbol e a The pre-trained language model is a commonly used deep learning method that can convert text data into word vectors. 1.8.4 e a+ and e a Calculating the cosine distance between: e a+ Transpose vector of and e a Multiply by and divide by the magnitude of both, and write the result as
number
number
number
number
number
number
number
number
[0040] (Appendix 3) The process of step 2 is as follows: 2.1 Loss function positive and negative example sampling: In the training process of the service recommendation model, the service data used in the loss function is extracted and classified according to the loss function positive and negative example sampling rules, which can be subdivided into two processes: loss function positive example sampling and loss function negative example sampling. 2.2 Loss function positive example sampling: According to the loss function positive and negative example sampling rules, we select loss function positive examples from the service data. 2.3 Loss function negative example sampling: According to the loss function positive and negative example sampling rules, select loss function negative examples from the service data. 2.4 Limiting the number of negative loss function examples: After performing 2.3 and obtaining the negative loss function examples, the method for sampling and re-recommending positive and negative loss function examples for Web 3.0 services as described in Appendix 1 or 2 is characterized in that the number of negative loss function examples is further limited by the similarity threshold ζ.
[0041] (Appendix 4) In 2.2 above, the process of loss function positive example sampling is as follows: 2.2.1 Loss Function We define a set of positive examples and denote it by the symbol set + It is expressed as 2.2.2 Traverse the API services in the service data and find the API service taken for the i-th time as a i year, 2.2.3 Traverse the call sequence in the service data and define the call sequence taken at the jth time as s j year, 2.2.4 s j ni a i If it contains a i is called directly, and a i The loss function positive examples
number
number
[0042] (Appendix 5) In 2.3 above, the process of loss function negative example sampling is as follows: 2.3.1 Extract all API services in the service data and construct set A; 2.3.2 Set A and loss function positive example set + The difference set is defined as the loss function negative example candidate set, denoted by preSet. 2.3.3 Loss function positive example set + and the i-th loss function positive example is denoted by the symbol
number
number
number
number
number
number
number
[0043] (Appendix 6) In 2.4 above, the process of limiting the number of negative examples of the loss function is as follows: 2.4.1 Define the similarity threshold ζ to be used to control the number of negative examples in the loss function, 2.4.2 Loss function negative example constraint set
number
number
number
number
number
number
number
number
number
number
number
number
number
number
number
number
[0044] (Appendix 7) The process of step 3 is as follows: 3.1 Construction of Diverse Sample Pairs: Sample pairs obtained by combining loss function positive examples and loss function negative examples after limiting the number can increase the diversity of service recommendation results compared to general sample pairs. 3.2 Defining the initial service recommendation result set: Based on the user query, the service recommendation model gives a set of initial API service recommendations, denoted by R d The service recommendation model is a conventional model that can learn and mine service data and provide service recommendation results based on user queries. This model is constructed using methods based on collaborative filtering and neural networks. 3.3 Optimization of the loss function convergence process: First, obtain a diversity sample pair based on 3.1, then replace the original data used in the loss function in 3.1 with the diversity sample pair, and retrain the model obtained in 3.2; 3.4 Diversified service recommendation result set: After 3.3, we define the set of recommended API services given by the service recommendation model as the diversified service recommendation result set, denoted by Rm The service data loss function positive and negative example sampling and re-recommendation method for web 3.0 described in Appendix 1 or 2, characterized in that it is represented by:
[0045] (Appendix 8) In the above 3.1, the process of constructing a diversity sample pair is as follows: 3.1.1 Define the diversity sample pair set multiSet, 3.1.2 Loss function positive example set + traverses the i-th loss function positive example
number
number
number
number
number
number
number
number
number
number
number
[0046] (Appendix 9) The process of step 4 is as follows: 4.1 Re-recommendation result: In order to improve the recommendation quality, after optimizing the service recommendation model, loss function, or data sample, we make two or more recommendations. The result is called the re-recommendation result, denoted by R. c It is expressed as 4.2 Integration of the initial service recommendation result set and the diversified recommendation result set: The initial service recommendation result set and the diversified recommendation result set are integrated according to the functional field and service combination. In the above 4.2, the integration process is as follows: 4.2.1 Re-recommendation result set R c Define 4.2.2 Define the correlation hyperparameter θ, 4.2.3 Define the diversity hyperparameter η, 4.2.4 Input the user's query into the service recommendation model to generate the initial service recommendation result set R d Give 4.2.5 Using Step 3, the diversified service recommendation result set R m Obtained, 4.2.6 R d traverses the i-th API service and returns a i year, 4.2.7 R m traverses the jth API service and returns the jth API service to a j year, 4.2.8 a i and a j If the same, a i R c and jump to 4.2.7, 4.2.9 a i and a j When the functional areas of both are different, i and c j and the symbol M i In a i represents the set of service combinations corresponding to M j In a j represents the set of service combinations corresponding to 4.2.10 c i and c j Calculate the Jaccard similarity coefficient between and and compare it with η. If the Jaccard similarity coefficient is smaller than η, jump to 4.2.7. 4.2.11 M i and M j Calculate the Jaccard similarity coefficient between θ and θ, and compare it with θ. If the Jaccard similarity coefficient is smaller than θ, jump to 4.2.7. 4.2.12 a i and a j R c Add to 4.2.13a j R m If it is the last API service in 4.2.14a i R d If it is the last API service in 4.2.15 R c and 4.3 Re-recommendation result re-sorting: The service data loss function positive and negative example sampling and re-recommendation method for Web 3.0 described in Appendix 1 or 2, characterized in that it uses the score matrix and similarity matrix to calculate the determinant point process and re-sort the re-recommendation results to balance the diversity and correlation of the recommendation results.
[0047] (Appendix 10) In 4.3, the process of rearranging the re-recommendation results using the determinant point process is as follows: 4.3.1 Define the similarity matrix, whose row and column elements are the similarities of the recommendation services, and denoted by Q. 4.3.2 Define a score matrix, whose row and column elements are the recommendation scores given by the service recommendation model, and denoted by the symbol P. 4.3.3 Define the kernel matrix, denoted by the symbol L. The kernel matrix is obtained by performing matrix operation on the score matrix and the similarity matrix. The operation formula is L=P·Q·P, where the symbol "·" represents matrix multiplication and the symbol "=" represents matrix substitution. 4.3.4 Define the balance coefficient, which represents the degree of balance between diversity and correlation of re-recommendation results, and is denoted by the symbol σ. 4.3.5 Re-recommended result set R using 4.2 c We obtain the symbol
number
number
number
number
number
number
number
number
Claims
1. A service data loss function positive and negative example sampling and re-recommendation method for web 3.0, In step 1, a loss function positive and negative example sampling rule is designed based on the functional domain and description document information of the API service in the service data. The process is as follows: 1.1 Service data: refers to the data used by the service recommendation model in the training process, including API services, functional areas, service combinations, call sequences, and description documents; 1.2 API service: an application program interface API, represented by the symbol a; 1.3 Functional field: The functional type and application field to which the API service belongs, represented by the symbol c, is the prior information of the API service; 1.4 Service Combination: Combining two or more API services to form a new API service, represented by symbol m, is the prior information of the API service; 1.5 Call sequence: A sequence of API services accessed by a user, ordered by time, represented by the symbol s. 1.6 Description document: Text data describing the functional field and interface information of an API service, represented by the symbol d, which is advance information of the API service. 1.7 Positive and negative examples of loss function: In the convergence process of the loss function, sampled service data are called positive examples of the loss function, and unsampled service data are called negative examples of the loss function. + and - Each loss function positive example has multiple corresponding loss function negative examples, and the combination of both is called a loss function positive / negative example. 1.8 Loss function positive and negative example sampling rule: Select the APIs directly called by users and indirectly called by service combinations from the service data as loss function positive examples. For other service data, first obtain the similarity using the loss function positive example similarity calculation method based on prior information, and then select the service data with high similarity as loss function negative examples. In step 2, sampling of positive and negative loss function examples is performed on the service data according to the loss function positive and negative example sampling rule created in step 1.8, and the number of negative loss function examples is limited using a similarity threshold ζ; In step 3, a diversity sample pair is constructed using the loss function positive and negative examples, and the convergence process of the loss function in the service recommendation model is optimized to obtain a diversity service recommendation result set; In step 4, the initial service recommendation result set and the diversified service recommendation result set are integrated to generate re-recommendation results, and finally, the re-recommendation results are re-sorted using a determinant point process method; The process of step 3 is as follows: 3.1 Construction of Diverse Sample Pairs: Sample pairs obtained by combining loss function positive examples and limited-number loss function negative examples can increase the diversity of service recommendation results compared to general sample pairs. 3.2 Definition of the initial service recommendation result set: Based on the user's query, the service recommendation model provides a set of initial API service recommendations, represented by the symbol R d . The service recommendation model is a conventional model that can learn and mine service data and provide service recommendation results based on the user's query. The model is constructed using a method based on collaborative filtering and neural networks. 3.3 Optimization of the loss function convergence process: First, obtain a diversity sample pair based on 3.1, then replace the original data used in the loss function in 3.1 with the diversity sample pair, and retrain the model obtained in 3.2; 3.4 Diversified service recommendation result set: After 3.3, the set of recommended API services given by the service recommendation model is defined as a diversified service recommendation result set, which is represented by the symbol R m . This is a service data loss function positive and negative example sampling and re-recommendation method for web 3.
0.
2. In 3.1, the process of constructing a diversity sample pair is as follows: 3.1.1 Define the diversity sample pair set multiSet, 3.1.2 Loss function positive example set + and the i-th loss function positive example is [Equation 1] The corresponding loss function negative example set after limiting the number is [Equation 2] year, 3.1.3 [Equation 3] Randomly select any number of loss function negative examples from 3.1.4 Traverse the randomly selected negative examples of the loss function and define the negative example of the loss function taken at the jth time as [Equation 4] year, 3.1.5 [Equation 5] and [Equation 6] The diversified sample pairs are constructed by the symbol [Equation 7] The symbols "<" and ">" are [Equation 8] and [Equation 9] is used to represent the bigram relationship between 3.1.6 [Equation 10] Add to multiSet, 3.1.7 [0011] is set + If it is the last positive example in the loss function, the traversal is terminated. 3.1.8 The method for sampling and re-recommending service data loss functions for positive and negative examples for Web 3.0 as claimed in claim 1, characterized in that it outputs a multiSet.
3. A service data loss function positive and negative example sampling and re-recommendation method for web 3.0, comprising: In step 1, a loss function positive and negative example sampling rule is designed based on the functional domain and description document information of the API service in the service data. The process is as follows: 1.1 Service data: refers to the data used by the service recommendation model in the training process, including API services, functional areas, service combinations, call sequences, and description documents; 1.2 API service: an application program interface API, represented by the symbol a; 1.3 Functional field: The functional type and application field to which the API service belongs, represented by the symbol c, is the prior information of the API service; 1.4 Service Combination: Combining two or more API services to form a new API service, represented by symbol m, is the prior information of the API service; 1.5 Call sequence: A sequence of API services accessed by a user, ordered by time, represented by the symbol s. 1.6 Description document: Text data describing the functional field and interface information of an API service, represented by the symbol d, which is advance information of the API service. 1.7 Positive and negative examples of loss function: In the convergence process of the loss function, sampled service data are called positive examples of the loss function, and unsampled service data are called negative examples of the loss function. These are represented by the symbols l + and l - , respectively. Each positive example of the loss function has multiple corresponding negative examples of the loss function, and the combination of the two is called a positive and negative example of the loss function. 1.8 Loss function positive and negative example sampling rule: Select the APIs directly called by users and indirectly called by service combinations from the service data as loss function positive examples. For other service data, first obtain the similarity using the loss function positive example similarity calculation method based on prior information, and then select the service data with high similarity as loss function negative examples. In step 2, sampling of positive and negative loss function examples is performed on the service data according to the loss function positive and negative example sampling rule created in step 1.8, and the number of negative loss function examples is limited using a similarity threshold ζ; In step 3, a diversity sample pair is constructed using the loss function positive and negative examples, and the convergence process of the loss function in the service recommendation model is optimized to obtain a diversity service recommendation result set; In step 4, the initial service recommendation result set and the diversified service recommendation result set are integrated to generate re-recommendation results, and finally, the re-recommendation results are re-sorted using a determinant point process method; The process of step 4 is as follows: 4.1 Re-recommendation result: In order to improve the recommendation quality, after optimizing the service recommendation model, loss function, or data sample, two or more recommendations are made. The result is called the re-recommendation result, and is denoted by the symbol R. c It is expressed as 4.2 Integration of the initial service recommendation result set and the diversified recommendation result set: The initial service recommendation result set and the diversified recommendation result set are integrated based on the functional field and service combination. In 4.2, the integration process is as follows: 4.2.1 Re-recommended result set R c Define 4.2.2 Define the correlation hyperparameter θ, 4.2.3 Define the diversity hyperparameter η, 4.2.4 Input the user's query into the service recommendation model and generate an initial service recommendation result set R d Give 4.2.5 Using Step 3, the diversified service recommendation result set R m Obtained, 4.2.6 R d traverses the i-th API service and i year, 4.2.7 R m traverses the j-th API service and j year, 4.2.8a i and a j is the same, a i R c Add it to 4.2.7, 4.2.9a i and a j When the functional areas of both are different, i and C j Let M i And a i represents the set of service combinations corresponding to M j And a j represents the set of service combinations corresponding to 4.2.10c i and C j Calculate the Jaccard similarity coefficient between η and η, and compare it with η. If the Jaccard similarity coefficient is smaller than η, jump to 4.2.
7. 4.2.11 M i and M j Calculate the Jaccard similarity coefficient between θ and θ, and compare it with θ. If the Jaccard similarity coefficient is smaller than θ, jump to 4.2.
7. 4.2.12a i and a j R c Add to 4.2.13a j is R m If it is the last API service in 4.2.14a i is R d If it is the last API service in 4.2.15 R c and 4.3 Re-sorting of re-recommendation results: A service data loss function positive and negative example sampling and re-recommendation method for Web 3.0, characterized in that it uses the score matrix and similarity matrix to calculate the determinant point process and re-sort the re-recommendation results to balance the diversity and correlation of the recommendation results.
4. In 4.3, the process of rearranging the re-recommendation results using the determinant point process is as follows: 4.3.1 Define a similarity matrix, whose row and column elements are the similarities of the recommended services, and denoted by the symbol Q. 4.3.2 Define a score matrix, whose row and column elements are the recommendation scores given by the service recommendation model, and denoted by the symbol P. 4.3.3 Define the kernel matrix, denoted by the symbol L. The kernel matrix is obtained by performing a matrix operation on the score matrix and the similarity matrix. The operation formula is L = P Q P, where the "·" symbol represents matrix multiplication and the "=" symbol represents matrix substitution. 4.3.4 Define the balance coefficient, which represents the degree of balance between diversity and correlation of re-recommendation results, and is denoted by the symbol σ. 4.3.5 Re-recommended result set R using 4.2 c We obtain the symbol [0012] In the core matrix, R c represents the sub-matrix indexed by 4.3.6 Kernel Matrix in R c Traverse all submatrices indexed by and take the result taken for the i-th time. [0013] year, 4.3.7 [0014] Perform the determinant calculation on and take the logarithm of the result, [Equation 15] where the symbol det denotes the determinant calculation, which is a basic matrix operation, the product of all elements in a matrix and the sum of the corresponding cofactors; the symbol log denotes the logarithm operation; 4.3.8 [0016] and σ are added, 4.3.9 [Equation 17] Terminate the traversal if is the last submatrix, 4.3.10 Perform a determinant calculation on Q and take the logarithm of the result; [Equation 18] year, 4.3.11 From σ [Equation 19] Subtract 4.3.12 Perform maximum a posteriori estimation on σ, i.e., R c The re-recommendation results are screened from the above, the value of σ is maximized, and the symbol R f represents the re-recommendation results after screening, 4.3.13 R f The method for sampling and re-recommending a service data loss function positive and negative examples for Web 3.0 according to claim 3, wherein the method outputs:
5. In the above 1.8, the calculation process of the loss function positive and negative example similarity based on prior information is as follows: 1.8.1 Loss Function: Arbitrarily select one API service that is a positive example, and + The functional area and description document to which each belongs are denoted by the symbol c + and d + It is expressed as 1.8.2 Arbitrarily select one API service from the other service data and denote it as a, and denote the functional area and description document to which it belongs by symbols c and d, respectively; 1.8.3d + and d are input to the pre-trained language model, and the obtained results are + and a are the embedding vectors of a+ and symbol e a The pre-trained language model is a commonly used deep learning method that can convert text data into word vectors. 1.8.4 e a+ and e a Calculating the cosine distance between: a+ The transpose vector of e a Multiply by and divide by the magnitude of both, and write the result as [Equation 20] It is expressed as 1.8.5 c + Calculation of the Jaccard similarity coefficient between and c: First, c + After adding the size of and the size of c, + Subtract the size of the intersection of and c, set the result as temp, and then + Divide the size of the intersection of and c by temp and [Equation 21] year, 1.8.6 The Jaccard similarity coefficient of the cosine distance is linearly transformed, and the result is limited to the range of 0 to 1. The linearly transformed results are each represented by the symbol [Equation 22] and symbol [Equation 23] A linear transformation is a mathematical operation that has the property that it preserves the addition of vectors and the multiplication of numbers. 1.8.7 [0000] and [Equation 25] Compare the sizes of the + and a are the similarity coefficients, and the symbol [Equation 26] It is expressed as 1.8.8 [0000] The method for sampling and re-recommending a service data loss function positive and negative examples for Web 3.0 according to any one of claims 1 to 4, further comprising:
6. The process of step 2 is as follows: 2.1 Loss function positive and negative example sampling: In the training process of the service recommendation model, the service data used in the loss function is extracted and classified according to the loss function positive and negative example sampling rules, which can be subdivided into two processes: loss function positive example sampling and loss function negative example sampling. 2.2 Loss function positive example sampling: Select loss function positive examples from the service data according to the loss function positive and negative example sampling rules. 2.3 Loss function negative example sampling: Select loss function negative examples from the service data according to the loss function positive and negative example sampling rules; 2.4 Limiting the number of negative examples of loss function: After obtaining the negative examples of loss function in accordance with 2.3, the method for sampling and re-recommending positive and negative examples of loss function for Web 3.0 service data as claimed in any one of claims 1 to 4 is characterized in that: the method further limits the number of negative examples of loss function according to the similarity threshold ζ.
7. In 2.2 above, the process of loss function positive example sampling is as follows: 2.2.1 Loss Function Define the positive example set and use the symbol set + It is expressed as 2.2.2 Traverse the API services in the service data and set the API service taken for the i-th time as a i year, 2.2.3 Traverse the call sequence in the service data and denote the call sequence taken at the jth time by s j year, 2.2.4 s j Nia i When i is called directly, and a i The loss function positive examples [0000] and set it + After adding it, jump to 2.2.2, 2.2.5 s j is the last call sequence in the service data, terminate the traversal; 2.2.6 Traverse the service combinations in the service data, and define the service combination taken at the kth time as m k year, 2.2.7 m k Nia i When i is called indirectly, and a i The loss function positive examples [0000] and set it + After adding it, jump to 2.2.2, 2.2.8 m k is the last call sequence in the service data, terminate the traversal; 2.2.9a i If is the last API service in the service data, terminate the traversal; 2.2.10 Loss function positive example set + The method for sampling and re-recommending a service data loss function positive and negative examples for web 3.0 according to claim 6, wherein:
8. In 2.3 above, the process of loss function negative example sampling is as follows: 2.3.1 Extract all API services in the service data and construct a set A; 2.3.2 Set A and loss function positive example set + The difference set is defined as the loss function negative example candidate set, and is represented by the symbol preSet. 2.3.3 Loss function positive example set + and the i-th loss function positive example is denoted by the symbol [Equation 30] It is expressed as 2.3.4 [Equation 31] Define the loss function negative example set corresponding to [Equation 32] It is expressed as 2.3.5 Traverse the preSet and denote the jth loss function negative example candidate by the symbol ps j It is expressed as 2.3.6 Loss function based on prior information defined in step 1.8: j and [Equation 33] The similarity between [Equation 34] It is expressed as 2.3.7 ps j of [Equation 35] Add to 2.3.8 ps j If is the last loss function negative example candidate in the preSet, terminate the traversal; 2.3.9 [Equation 36] is set + The method for web 3.0 service data loss function positive and negative example sampling and re-recommendation according to claim 6, characterized in that, if the last one in
9. In 2.4 above, the process of limiting the number of negative examples of the loss function is as follows: 2.4.1 Define the similarity threshold ζ to be used to control the number of negative examples in the loss function, 2.4.2 Loss function negative example constraint set [Equation 37] Define 2.4.3 Loss function positive example set + and the i-th loss function positive example is [Number 38] and the corresponding loss function negative example set is [Number 39] year, 2.4.4 [Equation 40] The n loss function negative examples with the highest similarity in - Select as 2.4.5 N - traverses the jth negative example of the loss function [Equation 41] year, 2.4.6 [Equation 42] and [Equation 43] Similarity with [Equation 44] year, 2.4.7 [Equation 45] Compare the size of and ζ, [Equation 46] When is large, [Equation 47] and hold it [Number 48] In addition to, when ζ is large, [Number 49] Throw away 2.4.8 [Number 50] N - If the last loss function negative example in 2.4.9 [Equation 51] is set + If it is the last positive example in the loss function, the traversal is terminated. 2.4.10 [Number 52] The method for sampling and re-recommending a service data loss function positive and negative examples for web 3.0 according to claim 6, wherein:
Citation Information
Patent Citations
Graph embedding enhanced Web API (Application Program Interface) recommendation method and system
CN114817745A
Application interface determination method and device, medium and equipment
CN116049273A
Web API recommendation method and device based on functional semantics and structure interaction
CN116628328A