Manufacturing micro-service discovery and dynamic screening method based on LDA and rule chain

Through the combination of LDA and rule chain, the problem of insufficient semantic understanding in the existing manufacturing microservice discovery method is solved, accurate discovery and dynamic screening of microservices is realized, efficiency and accuracy are improved, personalized needs are met, and personalized promotion is promoted. Automation and intelligence of manufacturing services.

CN118984332AActive Publication Date: 2024-11-19CHONGQING UNIV

Patent Information

Application Number
CN202410680815.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-11-19
Estimated Expiration
2044-05-29

AI Technical Summary

Technical Problem

The existing manufacturing microservice discovery methods lack semantic understanding and description capabilities, cannot meet users' personalized and dynamic needs, and are difficult to achieve accurate discovery and dynamic screening of microservices, resulting in inefficiency.

Method used

Using a method based on latent Dirichlet distribution (LDA) and rule chain, the domain service clustering model is constructed, and the semantic information of microservices is extracted, and the message event triggering mechanism of rule chains is combined to achieve accurate discovery and dynamic screening of microservices. .

Benefits of technology

It improves the efficiency and accuracy of manufacturing microservice discovery, meets users' personalized and dynamic needs, realizes efficient, accurate and personalized discovery and selection of microservices, and promotes the automation and intelligent development of manufacturing services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118984332A_ABST
    Figure CN118984332A_ABST
Patent Text Reader

Abstract

The invention discloses a manufacturing micro-service discovery and dynamic screening method based on LDA and a rule chain. The method comprises the following steps: constructing a domain service clustering model through an LDA algorithm, and training the domain service clustering model; obtaining a micro-service set containing a micro-service description document, inputting the micro-service set into the trained domain service clustering model, and outputting feature word column vectors of all micro-service themes; obtaining a rule set containing a rule description document, inputting the rule set into the trained domain service clustering model, and outputting feature word column vectors of all rule topics; a rule similar to micro-service semantics is matched by calculating the similarity of feature word column vectors of the micro-service and a rule theme, and an alternative rule set is generated; and generating a rule chain based on the alternative rule set in combination with set rule constraints, and realizing discovery and dynamic screening of micro-services through message event triggering of the rule chain. According to the method, the LDA and the rule chain are combined, semantic information and rule constraints of the manufacturing micro-service can be fully utilized, and accurate discovery and dynamic screening of the manufacturing micro-service are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet big data and microservices, and in particular to a manufacturing microservice discovery and dynamic screening method based on LDA and rule chains. Background Art

[0002] In the context of the Industrial Internet, microservice architecture, as a lightweight, modular software architecture style, is increasingly favored by manufacturing companies. Microservice architecture splits traditional monolithic applications into multiple small, autonomous service units, each of which is built and deployed around a specific business function to achieve high cohesion, loose coupling, and rapid iteration of the system. However, with the increasing number of microservices and the improvement of decoupling, how to effectively discover and dynamically select microservices that meet actual needs has become a new challenge facing manufacturing companies.

[0003] Traditional manufacturing microservice discovery methods mostly rely on manual search and recommendation, which are inefficient and difficult to adapt to large-scale and complex manufacturing environments. In order to solve this problem, a manufacturing microservice discovery method based on manufacturing service technology is proposed in the prior art, which realizes the discovery and selection of microservices by building and managing a microservice library of manufacturing services and using automation technology. For example, the Chinese patent with publication number CN114637266A discloses "A control method and device based on microservices", which includes: obtaining an operation command set of a manufacturing control system; identifying a hardware tag in the operation command, and determining at least one hardware operation library and a corresponding target controller corresponding to the operation command according to the hardware tag; filtering out the target control instruction corresponding to the hardware operation library and the operation command from the control library; sending the target control instruction to the target controller so that the target controller executes the target control instruction.

[0004] However, there are some problems with the existing manufacturing microservice discovery methods based on manufacturing service technology, which are mainly manifested in the following aspects: First, most of the existing methods lack the ability to understand and describe the semantics of manufacturing services, resulting in low precision and accuracy of microservice discovery. Second, the existing methods often ignore the rule constraints and associations of manufacturing microservices, and cannot meet the personalized and dynamic needs of users. In addition, the existing methods lack the ability to dynamically screen and optimize manufacturing microservices, and cannot achieve targeted microservice combination and optimization, resulting in low efficiency of microservice combination and optimization. Summary of the invention

[0005] In view of the deficiencies of the above-mentioned prior art, the technical problem to be solved by the present invention is: how to provide a manufacturing microservice discovery and dynamic screening method based on LDA and rule chain. By combining LDA and rule chain, the semantic information and rule constraints of manufacturing microservices can be fully utilized to achieve accurate discovery and dynamic screening of manufacturing microservices, thereby improving the efficiency and accuracy of manufacturing microservice discovery, and further providing manufacturing enterprises with an efficient, accurate and personalized manufacturing microservice discovery and selection solution, thereby promoting the automation and intelligent development of manufacturing services.

[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0007] The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain includes:

[0008] S1: Build a domain service clustering model through the LDA algorithm, and train and solve the domain service clustering model;

[0009] S2: Obtain a microservice set containing several microservice description documents and input them into the domain service clustering model, output the topic-feature word probability distribution of all microservices, and then construct the feature word column vector of the microservice topic;

[0010] S3: Obtain a rule set containing several rule description documents and input it into the domain service clustering model, output the topic-feature word probability distribution of all rules, and then construct the feature word column vector of the rule topic;

[0011] S4: Match rules with similar semantics to microservices by calculating the similarity between feature word column vectors of microservice topics and rule topics, and then select rules that meet the conditions and put them into the candidate rule set;

[0012] S5: Generate a rule chain based on the alternative rule set and the set rule constraints, and realize the discovery and dynamic screening of microservices through the message event triggering mechanism of the rule chain.

[0013] Preferably, in step S1, the input of the domain service clustering model is a description document, and the output is a document-topic probability distribution and a topic-feature word probability distribution of the description document.

[0014] Preferably, in step S1, the domain service clustering model generates a reconstructed document set consisting of feature words based on the input description document set, wherein the joint probability distribution P of the reconstructed document being consistent with the description document is expressed as:

[0015]

[0016] Where: P is the joint probability distribution, which indicates the probability that the reconstructed document generated by the domain service clustering model is consistent with the description document; Indicates that the topic distribution parameter θ is calculated for each description document J J The probability of , M is the number of documents; Indicates that the characteristic word distribution parameters are calculated for each topic I The probability of; K is the number of topics; Indicates that for each position t of each description document j, its topic Z is calculated j,t The probability of Indicates that the feature word W is calculated for each position t of each description document j j,t probability.

[0017] Preferably, in step S1, the domain service clustering model is trained and solved using the Gibbs sampling method to obtain document-topic probability distribution and topic-feature word probability distribution. The specific steps are as follows:

[0018] S101: Randomly assign an initial topic to each word in the description document;

[0019] S102: For each word in each description document, perform the following steps in sequence:

[0020] S1021: Randomly select a word w that describes document d, and record its current topic as z;

[0021] S1022: removing the association count between word w and topic z from description document d;

[0022] S1023: Considering the topic distribution of other words in the description document d and the topic distribution of word w in other description documents, calculate the conditional probability distribution of the possible topic distribution of word w;

[0023] S1024: reallocate a topic k to word w according to the conditional probability distribution of topic distribution;

[0024] S1025: Update the association count between word w and topic k in description document d;

[0025] S103: Repeat step S102 to implement iteration until the domain service clustering model converges or reaches the number of iterations;

[0026] S104: After the domain service clustering model is trained and solved by the Gibbs sampling method, each word is assigned a topic: the number of occurrences of each topic in each document is counted to obtain the document-topic probability distribution; the number of occurrences of each word under each topic is counted to obtain the topic-feature word probability distribution.

[0027] Preferably, in step S2, the characteristic word proportion corresponding to each microservice theme is calculated based on the theme-characteristic word probability distribution of all microservices to form a characteristic word column vector of the microservice theme, where the characteristic word column vector SV of the i-th microservice theme is i =(SW i1 ,SW i2 ,…,SW in ) T , S.W. in Indicates the proportion of the nth characteristic word in the i-th microservice topic;

[0028] In step S3, based on the topic-feature word probability distribution of all rules, the feature word ratio corresponding to each rule topic is calculated to form the feature word column vector of the rule topic, where the feature word column vector RV of the jth rule topic is j =(RW j1 ,RW j2 ,…,RW jm ), RW jm Indicates the proportion of the mth feature word in the jth microservice topic.

[0029] Preferably, in step S1, the domain service clustering model and a given description document set are used as input to calculate the topic perplexity, and the topic perplexity is used as the number of topics of the domain service clustering model;

[0030] The calculation formula of topic perplexity is as follows:

[0031]

[0032] Where: D represents the number of documents in a given description document set; N d represents the number of words describing the dth document; p(DS d ) represents the predicted probability of the domain service clustering model for the dth description document.

[0033] Preferably, in step S4, the candidate rule set is generated by the following steps:

[0034] S401: Determine the feature word column vector SV of the microservice topic i And the characteristic word column vector RV of the rule topic j ;

[0035] S402: SV i With RV j All the feature words in are combined into one word set and SV is calculated i With RV j The word frequency vector SV i ′ and RV j ′;

[0036] S403: RVj ′ is synthesized into a regular feature word probability distribution matrix SM;

[0037] The formula is:

[0038]

[0039] Where: a represents the total number of rules, satisfying 0≤j≤a;

[0040] S404: Column vector SV i ′ performs a dot product operation with each row of the matrix SM to obtain the dot product result Dot products ;

[0041] The formula is:

[0042]

[0043] S405: Calculate vector SV i The Euclidean norm of ′

[0044] S406: Calculate the Euclidean norm of each row of the matrix SM

[0045] S407: Use dot product result Dot products Calculate the cosine similarity with the Euclidean norm and get Cosine similarity[j] vector;

[0046] The formula is:

[0047]

[0048] S408: Cosine similarity[j] The rules corresponding to the values ​​reaching the similarity threshold STH are added to the candidate rule set.

[0049] Preferably, in step S5, the rule constraint includes an inter-layer relationship constraint, wherein the inter-layer relationship constraint considers the number of layers of the rule priority level;

[0050] When generating a rule chain, the rules in the candidate rule set are linked in order of priority: general level, subject level, and user-defined level.

[0051] Preferably, in step S5, the rule constraint includes an intra-layer relationship constraint, wherein the intra-layer relationship constraint considers the pre-rule set P of the rule R , conflicting rule set C R With the post-rule set S R ;

[0052] When generating a rule chain, the intra-layer rule chain RC should satisfy the relationship described by the following formula:

[0053]

[0054] Where: (RN q ∈RN q+1 .P R )∪(RN q+1 ∈RN q .S R ) means that the previous rule is in the preceding rule set of the subsequent rule, or the following rule is in the following rule set of the previous rule; Indicates that neither rule is in the other's conflicting rule set.

[0055] Preferably, in step S5, after the rule chain is generated, the symbols and values ​​of each rule node in the rule chain are adjusted according to its own needs to complete the dynamic screening of microservices.

[0056] Compared with the prior art, the manufacturing microservice discovery and dynamic screening method based on LDA and rule chain in the present invention has the following beneficial effects:

[0057] Aiming at the problem that the service scale is huge and the number of fields included in the current microservice architecture makes it difficult to filter services for some manufacturing enterprises, the present invention designs a manufacturing microservice discovery and dynamic screening method based on latent Dirichlet allocation (LDA) and rule chain. On the one hand, the present invention extracts topic information from a large number of microservice text descriptions by introducing the LDA model, constructs a domain service clustering model, and trains and solves the model through the Gibbs sampling method to achieve semantic understanding, abstraction and description of microservices, and then converts microservices into vector representations in the semantic topic space, thereby achieving automatic discovery of microservices in manufacturing-related fields. On the other hand, in order to narrow the screening scope of manufacturing microservices and improve the efficiency of subsequent microservice deployment, the present invention designs a rule set and rule chain generation method based on the above model. First, the feature word column vectors of microservices and rule nodes are obtained through the above model, and similarity matching is performed on them to generate a backup rule set that can constrain manufacturing microservices. Then, a rule chain is generated in combination with the set rule constraints to realize the discovery and dynamic screening of microservices through the message event triggering mechanism of the rule chain. Manufacturing enterprises can flexibly change the microservice screening strategy by real-time configuration of rule nodes according to production needs, which not only meets the user's personalized and dynamic needs, but also can effectively dynamically screen and optimize manufacturing microservices, and then discover manufacturing microservices that meet enterprise needs, thereby improving the efficiency of subsequent microservice optimization and deployment.

[0058] In summary, by combining LDA and rule chaining, the present invention can make full use of the semantic information and rule constraints of manufacturing microservices, realize the accurate discovery and dynamic screening of manufacturing microservices, and improve the efficiency and accuracy of manufacturing microservice discovery. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to make the purpose, technical solution and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:

[0060] Figure 1 It is the overall framework of the manufacturing microservice discovery and dynamic screening method based on LDA-rule chain;

[0061] Figure 2 It is the relationship structure of various parameters in the document generation process;

[0062] Figure 3 It is the process of document generation;

[0063] Figure 4 is the perplexity curve;

[0064] Figure 5 is the probability distribution result of topic-feature word (when the number of topics input is 7, 8, 9, and 10 respectively);

[0065] Figure 6 This is the distribution of feature words when the number of topics is 8;

[0066] Figure 7 It is the similarity matrix heat map of 8 topics and the first 20 rule nodes;

[0067] Figure 8 Display of heatmap matching results that meet the similarity threshold;

[0068] Fig. 9 Give an example of rule chaining;

[0069] Fig.10 The final screening results;

[0070] Fig.11 The efficiency of the service combination is compared whether the method of the present invention is used for preprocessing. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but only represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0072] It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. In the description of the present invention, it should be noted that the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, or the orientation or position relationship in which the invention product is usually placed when used, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance. In addition, the terms "horizontal", "vertical", etc. do not mean that the components are required to be absolutely horizontal or suspended, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", and does not mean that the structure must be completely horizontal, but can be slightly tilted. In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0073] The following is a further detailed description through specific implementation methods:

[0074] Example:

[0075] This embodiment discloses a manufacturing microservice discovery and dynamic screening method based on LDA and rule chain.

[0076] like Figure 1 As shown in the figure, the manufacturing microservice discovery and dynamic screening method based on LDA and rule chain includes:

[0077] S1: Construct a domain service clustering model (hereinafter referred to as an LDA model) through the Latent Dirichlet Allocation (LDA) algorithm, and train and solve the domain service clustering model;

[0078] S2: Obtain a microservice set containing several microservice description documents and input them into the domain service clustering model, output the topic-feature word probability distribution of all microservices, and then construct the feature word column vector of the microservice topic;

[0079] S3: Obtain a rule set containing several rule description documents and input it into the domain service clustering model, output the topic-feature word probability distribution of all rules, and then construct the feature word column vector of the rule topic;

[0080] S4: Match the rules with similar semantics to the microservice by calculating the similarity between the feature word column vectors of the microservice topic and the rule topic, and then (set a reasonable similarity threshold) filter out the rules that meet the (threshold) conditions and put them into the candidate rule set;

[0081] S5: Generate a rule chain based on the alternative rule set and the set rule constraints, and realize the discovery and dynamic screening of microservices through the message event triggering mechanism of the rule chain.

[0082] In this embodiment, after the rule chain is generated, the enterprise or user can adjust the symbols and values ​​of each rule node in the rule chain according to their own needs to complete the dynamic screening of microservices. Users can configure the properties of each rule node in the rule chain according to actual production needs, for example: the collection coverage of a certain device detecting microservices (such as collection coverage>0.7), etc. The message events of the rule chain include microservice updates and user demand updates.

[0083] Aiming at the problem that the service scale is huge and the number of fields included in the current microservice architecture makes it difficult to filter services for some manufacturing enterprises, the present invention designs a manufacturing microservice discovery and dynamic screening method based on latent Dirichlet allocation (LDA) and rule chain. On the one hand, the present invention extracts topic information from a large number of microservice text descriptions by introducing the LDA model, constructs a domain service clustering model, and trains and solves the model through the Gibbs sampling method to achieve semantic understanding, abstraction and description of microservices, and then converts microservices into vector representations in the semantic topic space, thereby achieving automatic discovery of microservices in manufacturing-related fields. On the other hand, in order to narrow the screening scope of manufacturing microservices and improve the efficiency of subsequent microservice deployment, the present invention designs a rule set and rule chain generation method based on the above model. First, the feature word column vectors of microservices and rule nodes are obtained through the above model, and similarity matching is performed on them to generate a backup rule set that can constrain manufacturing microservices. Then, a rule chain is generated in combination with the set rule constraints to realize the discovery and dynamic screening of microservices through the message event triggering mechanism of the rule chain. Manufacturing enterprises can flexibly change the microservice screening strategy by real-time configuration of rule nodes according to production needs, which not only meets the user's personalized and dynamic needs, but also can effectively dynamically screen and optimize manufacturing microservices, and then discover manufacturing microservices that meet enterprise needs, thereby improving the efficiency of subsequent microservice optimization and deployment.

[0084] In summary, by combining LDA and rule chain, the present invention can make full use of the semantic information and rule constraints of manufacturing microservices, realize accurate discovery and dynamic screening of manufacturing microservices, and improve the efficiency and accuracy of manufacturing microservice discovery. The feasibility and effectiveness of the method proposed in the present invention are proved through implementation, which provides new ideas and methods for intelligent service discovery and dynamic screening in the field of microservices of manufacturing enterprises.

[0085] In the specific implementation process, the input of the domain service clustering model is the description document, and the output is the document-topic probability distribution and topic-feature word probability distribution of the description document.

[0086] In the specific implementation process, the probability density function of the domain service clustering model is expressed as:

[0087]

[0088]

[0089] Where: x1, x2…, x k Represents the probability value of k categories; α1, α2…, α k represents the parameters of the distribution and satisfies α i >0; function B(α) is the multivariate beta function; Γ(·) represents the gamma function;

[0090] The parameter α of the LDA model can be seen as a concentration parameter that affects the shape of the distribution in each dimension. When the value of α is larger, the distribution tends to be more concentrated in each category, and when the value of α is smaller, the distribution tends to be more uniform.

[0091] For the convenience of description, we define a four-tuple to represent a domain service clustering model (DSCM) based on a probability model. The domain service clustering model is defined as DSCM = (DS, DT, V, PO), where DS = {S} is the domain microservice set, which represents the set of microservices belonging to a certain domain; DT = {T} is the topic set of all microservices in a specific domain; V = {t} represents the set of feature terms included in all microservices in a specific domain, and PO = {Policy} represents the probability of a microservice document containing different topics to determine which topic cluster the microservice belongs to;

[0092] The domain service clustering model generates a set of reconstructed documents consisting of feature words based on the input description document set, where the joint probability distribution P of the reconstructed documents generated by the domain service clustering model and the description documents is expressed as:

[0093]

[0094] Where: P is the joint probability distribution, which indicates the probability that the reconstructed document generated by the domain service clustering model (stop words are filtered out by the TF-IDF method. In fact, the document generated by LDA is just a bag-of-words model composed of many feature words without specific sentences) is consistent with the description document; Indicates that the topic distribution parameter θ is calculated for each description document J J The probability of , M is the number of documents; Indicates that the characteristic word distribution parameters are calculated for each topic I The probability of; K is the number of topics; Indicates that for each position t of each description document j, its topic Z is calculated j,t The probability of Indicates that the feature word W is calculated for each position t of each description document j j,t The probability of

[0095] The above formula describes the process of generating reconstructed documents by the domain service clustering model. Each word W in the reconstructed document j,t All of them are obtained by first starting with the topic distribution parameter θ j Medium sampling topic Z j,t , and then from the vocabulary distribution of the corresponding topic Sampling obtained.

[0096] In the specific implementation process, several documents consisting of a set of feature words are generated through the LDA model, but the computer often cannot understand the meaning of the feature words, and it can only focus on the occurrence of a certain feature word in the document. In view of the above problems, the present invention uses the Gibbs sampling method to train and solve the domain service clustering model. Gibbs sampling is a sampling method used in Markov Chain Monte Carlo (MCMC) and can be used to sample from multivariate probability distributions.

[0097] The specific steps are as follows:

[0098] S101: Randomly assign an initial topic to each word in the description document;

[0099] S102: For each word in each description document, perform the following steps in sequence:

[0100] S1021: Randomly select a word w that describes document d, and record its current topic as z;

[0101] S1022: removing the association count between word w and topic z from description document d;

[0102] S1023: Considering the topic distribution of other words in the description document d and the topic distribution of word w in other description documents, calculate the conditional probability distribution of the possible topic distribution of word w;

[0103] The goal of Gibbs sampling is to make it close to the distribution P(Z|W,α,β). Since W,α,β are known, and Z mn Indicates the topic corresponding to the nth word of the mth description document, Z -mn Represents Z without Z mn The topic distribution after that is as follows;

[0104]

[0105] S1024: reallocate a topic k to word w according to the conditional probability distribution of topic distribution;

[0106] S1025: Update the association count between word w and topic k in description document d;

[0107] S103: Repeat step S102 to implement iteration until the domain service clustering model converges or reaches the number of iterations;

[0108] S104: After the domain service clustering model is trained and solved by the Gibbs sampling method, each word is assigned a topic: the number of occurrences of each topic in each document is counted to obtain the document-topic probability distribution; the number of occurrences of each word under each topic is counted to obtain the topic-feature word probability distribution.

[0109] The Gibbs sampling adopted in the present invention is a local update method. For each variable in the document, only its neighboring variables need to be considered instead of the entire data set. This local property makes the computational efficiency of Gibbs sampling relatively high in LDA model training.

[0110] During the specific implementation, the feature word column vector is generated:

[0111] Based on the topic-characteristic word probability distribution of all microservices, the characteristic word proportion corresponding to each microservice topic is calculated to form the characteristic word column vector of the microservice topic, where the characteristic word column vector SV of the i-th microservice topic is i =(SW i1 ,SW i2 ,…,SW in ) T , S.W. in Indicates the proportion of the nth characteristic word in the i-th microservice topic.

[0112] Based on the topic-characteristic word probability distribution of all rules, the characteristic word proportion corresponding to each rule topic is calculated to form the characteristic word column vector of the rule topic, where the characteristic word column vector RV of the jth rule topic is j =(RW j1 ,RW j2 ,…,RW jm ), RW jm Indicates the proportion of the mth feature word in the jth microservice topic.

[0113] In the specific implementation process, for the topic model, once the selected algorithm is determined, the hyperparameter that needs to be manually determined is usually the number of topics. The number of topics largely determines the performance quality of the model, so appropriate adjustments need to be made in different scenarios. In the present invention, a method of calculating perplexity is used to measure the quality of the number of selected topics. Perplexity is an indicator used to evaluate the model fitting effect. The lower the perplexity, the better the performance of the model in predicting unseen text data.

[0114] Specifically, the domain service clustering model and a given description document set (i.e., the test set) are used as input to calculate the topic perplexity, and the topic perplexity is used as the number of topics in the domain service clustering model;

[0115] The calculation formula of topic perplexity is as follows:

[0116]

[0117] Where: D represents the number of documents in a given description document set; N drepresents the number of words describing the dth document; p(DS d ) represents the predicted probability of the domain service clustering model for the dth description document.

[0118] When calculating perplexity, the negative value of the log-likelihood function is usually used as a measure of perplexity. The lower the perplexity, the better the model fits the test set, that is, the model can more accurately predict the documents in the test set. In practical applications, there is often an inverted U-shaped relationship between perplexity and the number of topics, that is, within a certain range, the perplexity first decreases and then increases with the increase in the number of topics. Therefore, we will choose the number of topics that minimizes the perplexity as the optimal number of topics. However, when the number of topics is too large, the model tends to overfit, which will lead to poor performance on unseen data. In order to avoid this problem and improve the generalization ability and prediction performance of the model, the present invention uses the number of topics of the local optimal solution of the perplexity curve as the optimal number of topics for the model.

[0119] The present invention uses the LDA model to cluster microservices by topic and feature words, which has many advantages. For example, LDA can reduce the dimension of high-dimensional text data to a low-dimensional topic space; LDA can automatically assign a set of feature words to each topic and provide a brief label to help us understand the meaning of the topic. Figure 2 , Figure 3 A brief production process of microservice documentation is described, and the specific process is shown in the following algorithm.

[0120]

[0121] In the algorithm, the input hyperparameters α and β represent the Dirichlet distribution of document-topic and topic-feature word respectively; the formula in step 5 indicates that the probability of sampling is related to the topic distribution of the current feature word, document, and other feature words; finally, the topic distribution parameter θ of the document and the vocabulary distribution parameter of the topic are estimated by statistically obtaining the topic distribution Here, Dirichlet distribution is used to model the distribution of parameters. At this point, the service description document based on LDA is generated, and we have obtained the probability distribution of document-topic and topic-feature word.

[0122] In the specific implementation process, considering that the vector space of microservices and rule feature vocabulary is not large in scale and dimension, the present invention adopts a cosine similarity calculation method with high computational efficiency, and generates a candidate rule set that meets the requirements by setting a similarity threshold. The specific steps are as follows:

[0123] S401: Determine the feature word column vector SV of the microservice topic i And the characteristic word column vector RV of the rule topic j ;

[0124] S402: SV i With RV j All the feature words in are combined into one word set, and SV is calculated i With RV j The word frequency vector SV i ′ and RV j ′;

[0125] S403: RV j ′ Synthesize into a regular feature word probability distribution matrix SM;

[0126] The formula is:

[0127]

[0128] Where: a represents the total number of rules, satisfying 0≤j≤a;

[0129] S404: Column vector SV i ′ performs a dot product operation with each row of the matrix SM to obtain the dot product result Dot products ;

[0130] The formula is:

[0131]

[0132] S405: Calculate vector SV i The Euclidean norm of ′

[0133] S406: Calculate the Euclidean norm of each row of the matrix SM

[0134] S407: Use dot product result Dot products Calculate the cosine similarity with the Euclidean norm and get Cosine similarity[j] vector;

[0135] The formula is:

[0136]

[0137] S408: Add the rules corresponding to the values ​​of the Cosine_similarity vector that satisfy the set similarity threshold STH to the candidate rule set, thereby completing the generation of the candidate rule set.

[0138] In the specific implementation process, the rule priority level is defined as three levels, including the general level, the subject level, and the user-defined level, which are represented by LG, LF, and LC respectively, and there are strict link order regulations between the levels, with the priority decreasing from left to right. Each rule priority level is defined as a triple RL = (I, {R}, O), where I represents the number of the rule priority level, {R} represents the set of all rules in the level, and O represents the order restriction relationship between the rule level and other rule levels; the priority level to which a certain rule should belong is defined by the rule maker or user based on experience.

[0139] According to the flexible characteristics of the rule node, it is defined as a four-tuple RN = (NN, NL, ND, NL), assuming that RN is an indivisible minimum logical unit, that is, an atomic rule, where: NN represents the rule node code, which is used to determine the uniqueness of the rule node; NL represents the rule priority level to which the rule node belongs, which is determined by the rule engine or customized by the user; ND represents the rule node function description document, for example: "This node is used to filter services that meet the time cost requirements"; NL represents the constraint relationship between rule nodes, which can be defined as a triple NL = (PR, CR, SR), PR is the preceding rule set, CR is the conflicting rule set, and SR is the post-rule set.

[0140] The feature of rule chain triggered by message events is the key to realize dynamic configuration of services. After the rule node filter set is determined, they need to be chained according to a certain algorithm. A rule chain is defined as a triple RC = (M, R*, RR), where M represents the message event library, including microservice filtering requests, microservice updates, microservice failures and other message events, which are used to trigger the operation of the rule chain; R* represents the rule node set contained in the rule chain, and R* should satisfy RR represents the rule constraints for generating rule chains.

[0141] Define the Rule Set Generation Model (RSGM), and define RSGM as a five-tuple RSGM = (SV i ,RV j ,SCM,RS,STH) where SV i Represents the feature word column vector of the i-th service, which is composed of the topic-feature word probability distribution of the microservice, SV i =(SW j1 ,SW j2 ,…,SW jn ) T , where SW represents the proportion of feature words in the i-th microservice topic; RV j Represents the feature word vector of the jth rule, which is composed of the probability distribution of the feature words of the rule, RV j=(RW j1 ,RW j2 ,…,RW jm ), where RW represents the proportion of feature words in the jth rule; SCM represents the similarity calculation method between microservices and rule vectors, including cosine similarity, KL divergence, Jensen-Shannon divergence, etc.; RS represents the rule set, which is used to store the successfully matched rules; STH represents the similarity threshold, and the rules that meet the threshold requirements will be included in RS.

[0142] Specific;

[0143] 1) Rule constraints include inter-layer relationship constraints, where the inter-layer relationship constraints consider the number of layers of the rule priority level;

[0144] When generating a rule chain, the rules in the candidate rule set are linked in order of priority: general level, subject level, and user-defined level.

[0145] 2) Rule constraints include intra-layer relation constraints, where the intra-layer relation constraints consider the preceding rule set P of the rule R , conflicting rule set C R With the post-rule set S R ;

[0146] When generating a rule chain, the intra-layer rule chain RC should satisfy the relationship described by the following formula:

[0147]

[0148] Where: (RN q ∈RN q+1 .P R )∪(RN q+1 ∈RN q .S R ) means that the previous rule is in the preceding rule set of the subsequent rule, or the following rule is in the following rule set of the previous rule; Indicates that neither rule is in the other's conflicting rule set.

[0149] 3) For other cases, just link them in sequence according to the position relationship in the RS vector.

[0150] In order to better illustrate the advantages of the technical solution of the present invention, this embodiment discloses the following experiment.

[0151] This experiment uses the actual public data set Patent Dataset and actual automobile parts supply chain information to test the supply chain text information multi-level classification model (HAHMC) proposed in the present invention.

[0152] 1. Dataset

[0153] The experimental data comes from the IFLYTEK public dataset in Github, including more than 17,000 long text annotation data of application microservice descriptions, and 4782 rule nodes in the Node-Red rule engine tool, which are manually annotated short texts of rule descriptions. The data are shown in Tables 1 and 2.

[0154] Table 1 Microservice long text description

[0155]

[0156] Table 2 Short text description of rules

[0157]

[0158]

[0159] 2. Experimental Setup

[0160] All experiments and algorithms in the invention are implemented in Python. The topic-feature word probability distribution based on the LDA model is mainly based on the jieba and gensim libraries, and the visualization is mainly based on the pyLDAvis library. All experiments are run on a PC with an Intel(R) Core(TM) i5-10600KF CPU@4.10GHz, 16GB memory, and Windows 10 operating system.

[0161] 3. Effect indicators

[0162] 1) Optimal number of topics

[0163] For topic models, once the selected algorithm is determined, the hyperparameter that needs to be manually determined is usually the number of topics. The number of topics largely determines the performance quality of the model, so appropriate adjustments need to be made in different scenarios. In the present invention, a method of calculating perplexity is used to measure the pros and cons of the number of selected topics. Perplexity is an indicator used to evaluate the model fitting effect. The lower the perplexity, the better the performance of the model in predicting unseen text data. The calculation formula of perplexity is expressed as follows:

[0164]

[0165] Where D is the number of documents in the test set, N d is the number of words in the dth document, p(DS d) is the predicted probability of the model for the dth document. When calculating the perplexity, the negative value of the log-likelihood function value is usually used as a measure of the perplexity. The lower the perplexity, the better the model fits the test set, that is, the model can more accurately predict the documents in the test set. In practical applications, there is often an inverted U-shaped relationship between the perplexity and the number of topics, that is, within a certain range, the perplexity first decreases and then increases with the increase in the number of topics. Therefore, we will choose the number of topics that minimizes the perplexity as the optimal number of topics. However, when the number of topics is too large, the model tends to overfit, which will lead to poor performance on unseen data. In order to avoid this problem and improve the generalization ability and prediction performance of the model, the present invention adopts the number of topics of the local optimal solution of the perplexity curve as the optimal number of topics for the model.

[0166] 2) Topic distribution characteristics

[0167] By adopting the method used in the present invention, we can obtain the topic distribution characteristics of the microservice document collection, and select the topic distribution with the smallest overlap of different topics among all the results as the basis for subsequent experiments.

[0168] 3) Feature word vector similarity

[0169] Considering that the vector space of microservices and rule feature vocabulary is not large in scale and dimension, the present invention adopts a cosine similarity calculation method with high computational efficiency to generate a rule set that meets the requirements by setting a similarity threshold. The similarity calculation is as follows:

[0170]

[0171] 4) Microservice Combination Efficiency

[0172] The method of the present invention aims to discover and dynamically screen and manufacture microservices according to the needs of the enterprise (user), so as to improve the efficiency of subsequent microservice combination. Therefore, the method is of great significance to improving the efficiency of subsequent microservice combination, so the corresponding time of microservice combination is selected as the indicator.

[0173] 4. Experimental results

[0174] 1) Optimal number of topics

[0175] pass Figure 4 It can be seen that the perplexity curve shows a downward trend as the number of topics increases, but when the number of topics is 8, a local optimal solution appears, so the number of topics is temporarily set to 8 as the input of the LDA model.

[0176] 2) Topic-feature word probability distribution

[0177] Figure 5The figure shows the probability distribution of topics and feature words. Each circle on the left represents a topic obtained through classification, including multiple microservices in the same field. The fewer the intersections between circles, the lower the overlap between topics, indicating that the classification results are better. The experimental results of (a), (b), (c), and (d) respectively show the corresponding topic-feature word probability distribution results when the number of topics input to the LDA model is 7, 8, 9, and 10, respectively. It can be seen from the overlap of circles on the left side of the figure that when the number of topics input is 7, 9, and 10, there is a large overlap, while when the number of topics input is 8, there is only a small overlap between topics. The reason may be that some stop words have not been removed or the domain characteristics of some non-stop words are not obvious. Therefore, we choose the result when the number of topics input is 8 as the basis for subsequent experiments. The bar chart on the right shows the probability distribution of the occurrence of each feature word in a topic. Figure 6 The 8th topic in the model can be judged from its high-frequency feature words such as production, data, equipment, and efficiency that this microservice topic is related to the manufacturing field, and the feature words rarely include words reflecting other fields, indicating that the model solution result is good.

[0178] 3) Rule matching and rule chain generation

[0179] according to Figure 6 The 8 microservice topics generated in the above example are numbered 1-8, and the word frequency vectors of the rule nodes are also numbered 1-4782. The cosine similarity is calculated for each of them and the similarity between the 8 topics and the first 20 rule nodes is displayed as follows: Figure 7 As shown in Figure 1, the similarity threshold sth is set to 0.3, and all rule nodes matching the manufacturing field (topic 8) are obtained as follows: Figure 8 , forming the candidate rule set RS.

[0180] Select some rule nodes in the generated RS and generate a rule chain according to the predetermined rule chain generation method. Fig. 9 As shown, the configuration of each node is shown in Table 3.

[0181] Table 3 Rule node configuration

[0182]

[0183] In the table, the Switch node is a user-defined type. Enterprises need to flexibly adjust it within the operating range of the existing service data according to the actual needs of the manufacturing site. Due to the mechanism of rule chain message triggering, the needs of dynamic screening of microservices are met. The final screening results are as follows: Fig.10 shown.

[0184] 3) Validity Verification

[0185] In order to verify the effectiveness of the method of the present invention, a combined comparative experiment was conducted using the traditional genetic algorithm alone as the basis and the microservice data processed by the method of the present invention (LDA-RC). The combined response time was used as the comparison indicator. The experimental results are as follows: Fig.11 As shown in the results, it can be seen that the method of the present invention can reduce the time of microservice combination to a certain extent, because the method can automatically filter out most of the meaningless microservices.

[0186] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.

Claims

1. A manufacturing microservice discovery and dynamic screening method based on LDA and rule chain, characterized in that: include: S1: Build a domain service clustering model through the LDA algorithm, and train and solve the domain service clustering model; S2: Obtain a microservice set containing several microservice description documents and input them into the domain service clustering model, output the topic-feature word probability distribution of all microservices, and then construct the feature word column vector of the microservice topic; S3: Obtain a rule set containing several rule description documents and input it into the domain service clustering model, output the topic-feature word probability distribution of all rules, and then construct the feature word column vector of the rule topic; S4: Match rules with similar semantics to microservices by calculating the similarity between feature word column vectors of microservice topics and rule topics, and then select rules that meet the conditions and put them into the candidate rule set; S5: Generate a rule chain based on the alternative rule set and the set rule constraints, and realize the discovery and dynamic screening of microservices through the message event triggering mechanism of the rule chain.

2. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain as claimed in claim 1, characterized in that: In step S1, the input of the domain service clustering model is the description document, and the output is the document-topic probability distribution and topic-feature word probability distribution of the description document.

3. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain as claimed in claim 2, characterized in that: In step S1, the domain service clustering model generates a reconstructed document set consisting of feature words based on the input description document set, where the joint probability distribution P of the reconstructed document being consistent with the description document is expressed as: Where: P is the joint probability distribution, which indicates the probability that the reconstructed document generated by the domain service clustering model is consistent with the description document; Indicates that the topic distribution parameter θ is calculated for each description document J J The probability of , M is the number of documents; Indicates that the characteristic word distribution parameters are calculated for each topic I The probability of; K is the number of topics; Indicates that for each position t of each description document j, its topic Z is calculated j,t probability; Indicates that the feature word W is calculated for each position t of each description document f j,t probability.

4. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain as claimed in claim 3 is characterized by: In step S1, the domain service clustering model is trained and solved using the Gibbs sampling method to obtain the document-topic probability distribution and topic-feature word probability distribution. The specific steps are as follows: S101: Randomly assign an initial topic to each word in the description document; S102: For each word in each description document, perform the following steps in sequence: S1021: Randomly select a word w that describes document d, and record its current topic as z; S1022: removing the association count between word w and topic z from description document d; S1023: Considering the topic distribution of other words in the description document d and the topic distribution of word w in other description documents, calculate the conditional probability distribution of the possible topic distribution of word w; S1024: reallocate a topic k to word w according to the conditional probability distribution of topic distribution; S1025: Update the association count between word w and topic k in description document d; S103: Repeat step S102 to implement iteration until the domain service clustering model converges or reaches the number of iterations; S104: After the domain service clustering model is trained and solved by the Gibbs sampling method, each word is assigned a topic: the number of occurrences of each topic in each document is counted to obtain the document-topic probability distribution; the number of occurrences of each word under each topic is counted to obtain the topic-feature word probability distribution.

5. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain as claimed in claim 4, characterized in that: In step S2, based on the topic-characteristic word probability distribution of all microservices, the characteristic word proportion corresponding to each microservice topic is calculated to form the characteristic word column vector of the microservice topic, where the characteristic word column vector SV of the i-th microservice topic is i =(SW i1 , S.W. i2 ,…,SW in ) T , S.W. in Indicates the proportion of the nth characteristic word in the i-th microservice topic; In step S3, based on the topic-feature word probability distribution of all rules, the feature word ratio corresponding to each rule topic is calculated to form the feature word column vector of the rule topic, where the feature word column vector RV of the jth rule topic is j =(RW j1 , R.W. j2 , …, RW jm ), RW jm Indicates the proportion of the mth feature word in the jth microservice topic.

6. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain as claimed in claim 1, characterized in that: In step S1, the domain service clustering model and a given description document set are used as input to calculate the topic perplexity, and the topic perplexity is used as the number of topics in the domain service clustering model; The calculation formula of topic perplexity is as follows: Where: D represents the number of documents in a given description document set; N d represents the number of words describing the dth document; p(DS d ) represents the predicted probability of the domain service clustering model for the dth description document.

7. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain as claimed in claim 1, characterized in that: In step S4, a candidate rule set is generated through the following steps: S401: Determine the feature word column vector SV of the microservice topic i And the characteristic word column vector RV of the rule topic j ; S402: SV i With RV j All the feature words in are combined into one word set and SV is calculated i With RV j The word frequency vector SV i ′ and RV j ′; S403: RV j ′ is synthesized into a regular feature word probability distribution matrix SM; The formula is: Where: a represents the total number of rules, satisfying 0≤j≤a; S404: Column vector SV i ′ performs a dot product operation with each row of the matrix SM to obtain the dot product result Dot products ; The formula is: S405: Calculate vector SV i The Euclidean norm of ′ S406: Calculate the Euclidean norm of each row of the matrix SM S407: Use dot product result Dot products Calculate the cosine similarity with the Euclidean norm and get Cosine similarity[j] vector; The formula is: S408: Cosine similarity[j] The rules corresponding to the values ​​reaching the similarity threshold STH are added to the candidate rule set.

8. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain as claimed in claim 1, characterized in that: In step S5, the rule constraint includes an inter-layer relationship constraint, wherein the inter-layer relationship constraint considers the number of layers of the rule priority level; When generating a rule chain, the rules in the candidate rule set are linked in order of priority: general level, subject level, and user-defined level.

9. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain as claimed in claim 1, characterized in that: In step S5, the rule constraints include intra-layer relationship constraints, where the intra-layer relationship constraints consider the preceding rule set P of the rule. R , conflicting rule set C R With the post-rule set S R ; When generating a rule chain, the intra-layer rule chain RC should satisfy the relationship described by the following formula: Where: (RN q ∈RN q+1 .P R )∪(RN q+1 ∈RN q .S R ) means that the previous rule is in the preceding rule set of the subsequent rule, or the following rule is in the following rule set of the previous rule; Indicates that neither rule is in the other's conflicting rule set.

10. The manufacturing microservice discovery and dynamic screening method based on LDA and rule chain according to claim 1, characterized in that: In step S5, after the rule chain is generated, the symbols and values ​​of each rule node in the rule chain are adjusted according to the needs to complete the dynamic screening of microservices.

Citation Information

Patent Citations

  • Global social service network oriented Web service clustering method

    CN107135092A

  • Service discovery method based on clustering and Gaussian LDA

    CN111832289A

  • Product typicality characteristic mining method and system based on theme integration clustering

    CN114792246A

  • Intelligent issue analytics

    US20210157615A1

Cited By

  • Internet field customer index calculation method and system based on rule engine

    CN119167110A

  • RTOS-based adaptive optical storage all-in-one machine task scheduling system and method

    CN120144261A