A Weighted Bayesian Classifier and Ontology Mapping Method for Semantic Ontology
By introducing the weight Bayesian classifier and semantic dictionary WordNet expansion concept, combining the harmony search algorithm to optimize weights, the problem of the impact of the assumption of naive Bayesian classifier and low accuracy of ontology mapping is solved, and an automated and efficient ontology mapping is achieved.
Patent Information
- Application Number
- CN202310065609.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-13
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2043-01-13
AI Technical Summary
In the prior art, the attribute independent assumption of the naive Bayes classifier is difficult to meet the actual classification task, resulting in the impact of the classification results. The commonly used ontology mapping method has low mapping accuracy and requires manual determination of thresholds, which increases costs.
Weight Bayesian classifier is introduced, and the global optimal weight is calculated through the harmony search algorithm, and the weight naive Bayesian classifier is constructed, ontology mapping problems are converted into classification problems. The conceptual semantic information is expanded using semantic dictionary WordNet, and the threshold judgment is canceled.
Improve the accuracy of ontology mapping, reduce labor costs, enhance classification accuracy, and avoid threshold determination steps.
Smart Images

Figure CN116304904B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of the combination of machine learning technology and semantic web technology, and relates to a method for constructing a weighted Bayesian classifier using a heuristic optimization algorithm and a semantic interoperability ontology mapping method that uses the weighted Bayesian classifier in the field of machine learning to convert traditional semantic similarity calculation into a classification task. Background Art
[0002] The semantic web is a network that describes things in a machine-understandable way. Its basic idea is to enable machines or devices to automatically identify and understand the content of the Internet, automatically process and integrate data from different data sources, making it more intelligent and convenient to obtain information from the Web. On the semantic web, information is described in a structured form, which allows people to represent the knowledge in a domain as a classification system of concepts. Concepts have their own attributes, and there are various relationships between concepts. When information is marked with ontologies, machines can understand its meaning, and thus can automatically complete information collection and integration on the Internet. The original intention of establishing ontologies is for knowledge sharing. However, it is still very difficult to establish a global and general large ontology. Existing ontologies are often constructed by different ontology development teams, and the ontology construction standards are inconsistent, resulting in ontology heterogeneity. With the development of the semantic web, the number of heterogeneous ontologies is also increasing, which has caused great obstacles to knowledge sharing, reuse between heterogeneous ontologies, and interoperability between systems where heterogeneous ontologies are located. Therefore, it is very necessary to study ontology mapping.
[0003] Since ontology mapping can solve the problems of knowledge sharing, reuse between heterogeneous ontologies, and interoperability between systems where heterogeneous ontologies are located, more and more research has been carried out on ontology mapping by scientific researchers. Figure 1 The steps of the ontology mapping method based on similarity calculation include six parts: feature extraction, entity pair selection, similarity calculation, similarity integration, optimization, and iteration. Currently, the commonly used ontology mapping algorithms complete ontology mapping by calculating the similarity between concepts in the ontologies participating in the mapping. It includes similarity calculation based on the information content of ontology concepts and similarity calculation based on the semantic distance of ontology concepts. The former needs to consider the information amount of the nearest common parent node of the concept pair, and the latter calculates the semantic distance by calculating the geometric distance between two concepts.
[0004] Currently, the ontology mapping method based on calculating semantic similarity has a low mapping accuracy rate and requires determining a mapping threshold, which needs to be judged manually. When the number of ontologies participating in the mapping is relatively large, it will increase a lot of labor costs. To solve the existing problems, the present invention proposes a weighted Bayesian classifier and an ontology mapping method for semantic ontologies. This algorithm introduces a weighted Bayesian classifier and uses the harmony search algorithm to calculate the global optimal weights of the weighted Bayesian classifier, so as to reduce the impact brought by the "attribute conditional independence assumption" of the naive Bayesian classifier. And by using the weighted Bayesian classifier, the ontology mapping problem is transformed into a classification problem, which automatically completes the classification. While improving the mapping accuracy rate, it also avoids the step of threshold determination and reduces labor costs.
[0005] The main technical problems solved by the present invention are as follows:
[0006] 1. In order to simplify the calculation of the posterior probability, the naive Bayesian classifier proposes the "attribute independence assumption". This assumption is very restrictive, and the samples participating in real classification tasks often difficult to meet this assumption, so it will have a certain impact on the classification results. To solve this problem, the present invention introduces a weighted Bayesian classifier, sets the classification error rate as the objective function, dynamically searches for the global optimal weights, and normalizes the weights.
[0007] 2. In order to improve the optimization ability of the harmony search algorithm, this paper studies the relationship between the relevant parameters of the harmony search algorithm and the optimization ability, proposes dynamic parameters, designs corresponding functions according to the characteristics of the algorithm parameters, and makes the algorithm parameters change with the number of iterations, so as to better meet the requirements of the algorithm for global exploration and rapid convergence.
[0008] 3. Aiming at the problems existing in the currently commonly used algorithms for ontology mapping by calculating semantic similarity, this paper proposes a weighted Bayesian classifier and an ontology mapping method for semantic ontologies. The ontology is parsed through Jena, and then the ontology concepts are expanded by using the semantic dictionary WordNet. While improving the concept semantic information, the concepts are also turned into samples with multiple attributes. By introducing a weighted naive Bayesian classifier, the mapping problem is transformed into a classification problem, and the mapping is automatically completed. Summary of the Invention
[0009] The present invention aims to solve the above problems of the prior art. A weighted Bayesian classifier and an ontology mapping method for semantic ontologies are proposed. The technical solutions of the present invention are as follows:
[0010] A weighted Bayesian classifier and an ontology mapping method for semantic ontologies, which includes the following steps:
[0011] S1: Parse the ontology: This step includes ontology parsing and ontology concept expansion. First, use Jean to parse the ontologies involved in ontology mapping and extract all the concepts in the ontologies. At this time, the parsed concepts are single concepts lacking semantic information. To improve the semantic information of the concepts, use the hypernyms and hyponyms with semantic information in the WordNet semantic dictionary to expand the concepts. The expanded concepts are equivalent to samples with multiple attributes.
[0012] S2: Determine the weights: To simplify the calculation of the posterior probability, the naive Bayes classifier proposes the "attribute conditional independence assumption", which assumes that all attributes of a sample are independent of each other. However, in real-world classification tasks, it is difficult to meet this assumption, which affects the classification results. To reduce the impact brought by this assumption, introduce the weighted Bayes classifier and assign corresponding weights to each attribute in the sample to represent the influence degree of each attribute on the classification result. The expression is as follows:
[0013]
[0014] where P(c i |x) represents the probability that the sample x belongs to the category c i , P(c i ) is the prior probability, P(x) is the likelihood probability, a j represents the j-th attribute in the sample x, w(j) represents the weight of the j-th attribute in the sample x, used to represent the influence degree of this attribute on the classification result, n is the number of attributes in the sample x, and P(a j |c i ) is the conditional probability.
[0015] S3: Build the weighted Bayes classifier: Based on the weights obtained in the previous step, build a weighted naive Bayes classifier, convert the ontology mapping problem into a classification problem, calculate the maximum posterior probability to complete the classification; finally, save the output classification result to the AllergoGraph database.
[0016] S4: Ontology mapping process based on weighted Bayesian classifier: The commonly used ontology mapping algorithms determine whether the similarity between two concepts is greater than the mapping threshold. If it is greater, it is considered that there is a mapping relationship between these two concepts. In the present invention, the ontology mapping problem is transformed into a classification problem by constructing a weighted Bayesian classifier. The problem of finding the best mapping relationship for a certain concept is transformed into the problem of classifying it. Suppose there is an ontology Onto1 and another ontology Onto2. There are x concepts in ontology Onto1 and y concepts in ontology Onto2. According to what is described in step S1, the two ontologies are parsed and conceptually expanded. The concepts in both ontologies can be regarded as samples with multiple attributes. These samples are used as data and input into the weighted Bayesian classifier. The weighted Bayesian classifier will calculate the probability that each concept in ontology Onto1 belongs to all concepts in ontology Onto2, and find the largest posterior probability among all posterior probabilities to complete the classification, that is, to achieve ontology mapping. For example, for a concept C in ontology Onto1 i , 1 ≤ i ≤ x, the weighted Bayesian classifier will calculate the probability that concept C i belongs to all concepts C1, C2,..., C y in ontology Onto2. Suppose the probability that concept C i belongs to concept C y is the largest, then it can be considered that there is a mapping relationship between concept C i and concept C y . The ontology mapping method based on machine learning transforms the mapping problem into a classification problem. The problem of selecting the optimal mapping for a certain concept is transformed into the problem of classifying it, thus completing ontology mapping.
[0017] Further, in step S1, the ontology participating in the ontology mapping is parsed through the Jena package in Java to extract concepts, and the concept expansion is completed using the semantic dictionary WordNet. The specific steps are as follows:
[0018] S11: Import the Jean package: Jena is an open-source tool of the Semantic Web Research Project Group of HP Labs and is a Java-based semantic web application framework. Through Jena, the ontology to be input is parsed to extract the concepts therein and save them;
[0019] S12: Concept expansion: The hypernyms and hyponyms in the semantic dictionary WordNet contain rich semantic information and can be used to expand concepts and enhance the semantic information of concepts.
[0020] Further, in step S2, the harmony search algorithm is used to determine the weights: A dynamic weight mechanism is introduced. The specific steps are as follows:
[0021] S21: Determine the evaluation function: The training samples for classification by the Naive Bayes classifier contain the categories for classification, which belongs to supervised clustering. Use the classification error rate as the evaluation function and dynamically determine the weights through the harmony search algorithm. The expression is as follows:
[0022] f(x) = 1 - accuracy_rate
[0023] Where accurac_y ra is the classification accuracy rate, which can be calculated from the training samples of the Naive Bayes classifier;
[0024] S22: Initialize the relevant parameters of the harmony search algorithm according to relevant rules, and set each harmony as the weight corresponding to the sample attributes;
[0025] S23: Generate a new solution in a new way: In the form of a vector, let the generated new solution move towards the direction of the optimal solution in the harmony memory library while moving in the opposite direction of the worst solution in the harmony memory library;
[0026] S24: Determine whether to accept the generated new solution: Judge through the evaluation function. If the currently generated new solution is better than the worst solution in the harmony memory library, then replace the worst solution in the memory library with the generated new solution. If this solution is worse than the worst solution in the current memory library, then accept this solution with a certain probability, and this probability gradually decreases with the number of iterations;
[0027] S25: Determine whether the iteration stop condition is met: If the iteration stop condition is not met, continue to generate new solutions for judgment. If the iteration stop condition is met, output the calculated weight value.
[0028] Furthermore, the harmony search algorithm in step S22 specifically includes:
[0029] Step 1: Initialize the relevant parameters of the harmony search algorithm: First, it is necessary to determine the objective function of the problem to be solved. Through the objective function, the generated solutions can be judged to see if the generated solutions are optimal. In addition, other parameters required by the harmony search algorithm also need to be initialized, including the upper and lower limits of the solution space, the harmony memory storage consideration probability HMCR, the pitch fine-tuning probability PAR, and the pitch fine-tuning bandwidth BW parameters;
[0030] Step 2: Randomly generate a number r1 between 0 and 1;
[0031] Step 3: Generate a new solution: Judge whether the randomly generated r1 is greater than the harmony memory storage consideration probability HMCR. If it is greater, then the generated variable will be randomly selected from the harmony memory library, and the variable will be fine-tuned with a certain probability. If it is less, the variable will be randomly generated in a pre-set solution space with upper and lower limits;
[0032] Step 4: Determine whether n variables are generated. n is a parameter set in Step 1, and specifically represents the number of variables. If n variables are not generated, it will jump to Step 2 until n variables are generated and then enter the next step.
[0033] Step 5: Judge the newly generated solution. Substitute the newly generated solution into the objective function for solution, and then compare it with the worst solution in the harmony memory library. According to the comparison result, perform corresponding steps. If the newly generated solution is better than the worst solution in the harmony memory library, then replace the poor solution with the newly generated solution, that is, update the harmony memory library; otherwise, discard it and do not update the harmony memory library.
[0034] Step 6: Determine whether the stop iteration condition is met. If the stop iteration condition is not met, jump to Step 2 and repeat Steps 2 to 6 until the stop iteration condition is met; output the result.
[0035] Further, the specific content of Step S23 includes: while making the newly generated solution move towards the optimal solution in the harmony memory library, move in the direction opposite to the worst solution. The specific expression is as follows:
[0036] new_x = new_x - x r + x r
[0037] = random1 × (x best - x r ) + (-random2 × (x worst - x r )) + x r
[0038] = x r + random1 × (x best - x r ) - random2 × (x worst - x r )
[0039] where x r represents a solution randomly generated in the harmony memory library, x best represents the optimal solution in the harmony memory library, x worst represents the worst solution in the harmony search library, Random1 and Random2 are random numbers between 0 and 1, and new_x represents the newly generated solution.
[0040] The advantages and beneficial effects of the present invention are as follows:
[0041] The Naive Bayes classifier proposes the "attribute conditional independence" assumption to simplify the calculation of the posterior probability. However, it is difficult for classification samples in real classification tasks to meet this assumption, which will therefore have a certain impact on the final classification result. To address this issue, the present invention introduces a weighted Bayes classifier, which assigns weights to each attribute of the sample to represent the influence degree of each attribute on the classification result, thereby reducing the impact brought by the assumption proposed by the Naive Bayes classifier; the commonly used ontology mapping method is to perform mapping by calculating the semantic similarity between two concepts. Currently, there are problems in various algorithms for calculating semantic similarity, such as low mapping accuracy, and different thresholds need to be determined for different ontologies, and ultimately manual operations are required, increasing the cost. The algorithm provided by the present invention parses the ontology through Jena, and then uses the semantic dictionary WordNet to expand the ontology concepts, enhancing the semantic information of the ontology concepts and making the concepts into samples with multiple attributes, facilitating the use of the weighted Bayes classifier for classification. Thus, the ontology mapping problem is transformed into a classification problem, that is, the problem of finding the best mapping relationship for a certain concept is transformed into its classification problem, improving the mapping accuracy and eliminating the use of thresholds, enabling automatic mapping and reducing the labor cost.
[0042] The commonly used ontology mapping method for calculating semantic similarity has problems such as low mapping accuracy, and it is difficult to determine the mapping threshold for different ontologies, and manual judgment is still required. To address these problems, the present invention uses the Naive Bayes classifier in machine learning to transform ontology mapping into classification, improving the mapping accuracy and at the same time avoiding the use of mapping thresholds and reducing the labor cost; the concepts traditionally involved in ontology mapping are single concepts with relatively low semantic information. The present invention uses the semantic dictionary WordNet to expand ontology concepts to enhance semantic information; the classic Naive Bayes classifier proposes the attribute conditional independence assumption to simplify the calculation process of the posterior probability, so it has the characteristics of simple and efficient classification. However, it is often difficult to meet this assumption in real classification tasks, which will affect the classification result to a certain extent. To address this issue, the present invention uses the harmony search algorithm, with the classification error rate as the objective function, to calculate the optimal weights for each attribute in the training samples of the Naive Bayes classifier, representing the importance degree of each attribute to the classification result, thereby reducing the impact caused by this assumption and improving the classification accuracy. Brief Description of the Drawings
[0043] Figure 1 is the flowchart of ontology mapping for the preferred embodiment provided by the present invention
[0044] Figure 2 The overall architecture diagram of the algorithm provided by the present invention;
[0045] Figure 3 The overall flowchart of the ontology mapping method provided by the present invention;
[0046] Figure 4 Schematic diagram of semantic information expansion of ontology concepts
[0047] Figure 5 Flowchart of harmony search algorithm;
[0048] Figure 6 A new way to generate solutions by harmony search algorithm. Specific implementation manner
[0049] Next, the technical solutions in the embodiments of the present invention will be clearly and detailedly described in conjunction with the accompanying drawings in the embodiments of the present invention. The described embodiments are only a part of the embodiments of the present invention.
[0050] The technical solution of the present invention to solve the above technical problems is:
[0051] With the rapid development of the semantic web, the number of heterogeneous ontologies is also increasing, which has caused great obstacles to the interoperability between heterogeneous ontologies. In this context, the present invention proposes a weighted Bayesian classifier and ontology mapping method for semantic ontologies. This method introduces a weighted Bayesian classifier, sets the classification error rate as the evaluation function, and uses the harmony search algorithm to calculate the global optimal weight to improve the classification performance; then introduces weighted Bayesian classification to convert the traditional mapping problem of calculating semantic similarity into a classification problem. The present invention mainly includes two stages, ontology parsing and classification process. In the ontology parsing process, first, the ontologies participating in the ontology mapping process are obtained from the AllergoGraph database, and then the Jena package written in Java language is used to parse the ontologies to obtain the concepts in the ontologies, and then the concepts in the ontologies are expanded through the semantic dictionary WordNet to improve the semantic information of the concepts; the second stage is the classification process. In this process, first, the classification error rate is set as the objective function of the harmony search algorithm, and then new solutions are continuously generated and iterated until the global optimal weight is obtained. Then, the obtained weight is normalized, and then a weighted naive Bayesian classifier is constructed to calculate the maximum posterior probability to complete the classification. Finally, the output classification result is saved to the AllergoGraph database.
[0052] In view of this, the purpose of the present invention is to provide a weighted Bayesian classifier and ontology mapping method for semantic ontologies. By introducing a weighted Bayesian classifier, the mapping problem is converted into a classification problem, and the problem of selecting the optimal mapping for a certain element is converted into the problem of classifying it. Using the classification error rate as the evaluation function, the optimized harmony search algorithm is used to dynamically assign corresponding weights to each attribute of the training samples of the naive Bayesian classification, so as to reduce the influence brought by the attribute conditional independence assumption of the naive Bayesian classifier, thereby converting the ontology mapping into classification.
[0053] To achieve the above object, the present invention provides the following technical solutions:
[0054] A weighted Bayesian classifier and ontology mapping method for semantic ontology, comprising the following steps:
[0055] S1: Parse the ontology: This step includes ontology parsing and ontology concept expansion. First, use Jean to parse the ontologies participating in the ontology mapping, and extract all the concepts in the ontology. At this time, the parsed concepts are single concepts and lack semantic information. To improve the semantic information of the concepts, the hypernyms and hyponyms with semantic information in the WordNet semantic dictionary are used to expand the concepts. The expanded concepts are equivalent to samples with multiple attributes.
[0056] S2: Determine the weights: To simplify the calculation of the posterior probability, the naive Bayesian classifier proposes the "attribute conditional independence assumption", which assumes that all attributes of the sample are independent of each other. However, in real classification tasks, it is difficult to meet this assumption, which affects the classification results. To reduce the impact brought by this assumption, a weighted Bayesian classifier is introduced, and corresponding weights are assigned to each attribute in the sample to represent the influence degree of each attribute on the classification result. The expression is as follows:
[0057]
[0058] Where P(c i |x) represents the probability that the sample x belongs to the category c i The probability of, P(c i ) is the prior probability, P(x) is the likelihood probability, a j Represents the j-th attribute in the sample x, w(j) represents the weight of the j-th attribute in the sample x, used to represent the influence degree of this attribute on the classification result, n is the number of attributes in the sample x, and P(a j |c i ) is the conditional probability.
[0059] S3: Construct a weighted naive Bayesian classifier: Based on the weights obtained in the previous step, a weighted naive Bayesian classifier is established to convert the ontology mapping problem into a classification problem.
[0060] S4: Ontology mapping process based on weighted Bayesian classifier: The commonly used ontology mapping algorithms determine whether the similarity between two concepts is greater than the mapping threshold. If it is greater, it is considered that there is a mapping relationship between these two concepts. In the present invention, the ontology mapping problem is transformed into a classification problem by constructing a weighted Bayesian classifier. The problem of finding the best mapping relationship for a certain concept is transformed into the problem of classifying it. Suppose there is an ontology Onto1 and another ontology Onto2. There are x concepts in ontology Onto1 and y concepts in ontology Onto2. According to step S1, the two ontologies are parsed and conceptually extended. The concepts in both ontologies can be regarded as samples with multiple attributes. These samples are used as data and input into the weighted Bayesian classifier. The weighted Bayesian classifier will calculate the probability that each concept in ontology Onto1 belongs to all concepts in ontology Onto2, and find the largest posterior probability among all posterior probabilities to complete the classification, that is, to achieve ontology mapping. For example, for a concept C in ontology Onto1 i , 1 ≤ i ≤ x, the weighted Bayesian classifier will calculate the probability that concept C i belongs to all concepts C1, C2,..., C y in ontology Onto2. Suppose the probability that concept C i belongs to concept C y is the largest, then it can be considered that there is a mapping relationship between concept C i and concept C y . The ontology mapping method based on machine learning transforms the mapping problem into a classification problem. The problem of selecting the optimal mapping for a certain concept is transformed into the problem of classifying it, thereby completing ontology mapping.
[0061] Furthermore, the ontology parsing and ontology extension in step S1 include the following steps:
[0062] S11: Import the Jean package: Jena is an open-source tool of the Semantic Web Research Project Group of HP Labs and is a Java-based semantic web application framework. The ontology to be input is parsed through Jena, and the concepts therein are extracted and saved;
[0063] S12: Concept extension: The hypernyms and hyponyms in the semantic dictionary WordNet contain rich semantic information and can be used to extend concepts and enhance the semantic information of concepts;
[0064] Furthermore, the steps for determining weights in step S2 are as follows:
[0065] S21: Determine the evaluation function: The training samples for classification by the naive Bayesian classifier contain the classification categories, so it belongs to supervised clustering. The classification error rate can be used as the evaluation function, and the weights are dynamically determined through the harmony search algorithm;
[0066] S22: Initialize the relevant parameters of the harmony search algorithm according to relevant rules, and set the weight corresponding to each sample attribute;
[0067] S23: Generate a new solution in a new way: The traditional harmony search algorithm uses a random step size to generate a new solution, which has problems such as strong randomness, difficult to determine the random step size, and easy to fall into local optimum. To address this issue, a new way is used to generate a new solution. In the form of a vector, while the generated new solution moves towards the direction of the optimal solution in the harmony memory library, it also moves in the opposite direction of the worst solution in the harmony memory library;
[0068] S24: Determine whether to accept the generated new solution: Judge through the evaluation function. If the currently generated new solution is better than the worst solution in the harmony memory library, then replace the worst solution in the memory library with the generated new solution. If this solution is worse than the worst solution in the current memory library, then accept this solution with a certain probability, and this probability gradually decreases with the number of iterations;
[0069] S25: Determine whether the iteration stop condition is met: If the iteration stop condition is not met, continue to generate new solutions for judgment. If the iteration stop condition is met, output the calculated weight value.
[0070] Furthermore, in step S3, the specific process of using the naive classifier to complete the ontology mapping is as follows:
[0071] S31: Calculation of prior probability: Use the expanded concept as the training sample of the naive Bayes classifier, and construct the naive Bayes classifier to calculate the prior probability;
[0072] S32: Laplace correction: If a certain attribute value and a certain category do not appear simultaneously in the training set, it will cause the calculated maximum posterior probability to be 0. To avoid this situation, "Laplace correction" is used for smoothing;
[0073] S33: Standardize the weight calculated in step S25, and then assign the standardized weight to each attribute of the naive Bayes classifier sample to represent the influence degree of different attribute classification results;
[0074] S34: Calculation of posterior probability: Calculate the probability that a sample belongs to a certain category according to the calculated weight and the formula of the Bayes classifier after Laplace correction, and then calculate the maximum posterior probability to complete the classification, that is, complete the ontology mapping.
[0075] Such as Figure 2As shown in the figure, the present invention mainly includes two stages: ontology parsing and classification process. In the ontology parsing process, first, the ontologies participating in the ontology mapping process are obtained from the AllergoGraph database, and then the Jena package written in Java language is used to parse the ontologies to obtain the concepts in the ontologies. Then, the concepts in the ontologies are expanded through the semantic dictionary WordNet to improve the semantic information of the concepts. The second stage is the classification process. In this process, the error rate of classification is first set as the objective function of the harmony search algorithm, and then new solutions are continuously generated and iterated until the globally optimal weights are obtained. Then, the obtained weights are normalized, and a weighted Naive Bayes classifier is constructed to calculate the maximum posterior probability to complete the classification. Finally, the output classification results are saved in the AllergoGraph database.
[0076] A weighted Bayesian classifier and ontology mapping method for semantic ontology. Figure 3 The overall process of the ontology mapping algorithm provided by the present invention. The present invention uses the Naive Bayes classifier in the field of machine learning to convert the ontology mapping into a classification problem. The harmony search algorithm is mainly used to dynamically calculate the weights of each attribute in the training samples of the Naive Bayes classifier, and then the classification is completed by calculating the maximum posterior probability.
[0077] The specific steps of the present invention are as follows:
[0078] Ontology parsing: For the two ontologies participating in the ontology mapping, it is necessary to parse them to obtain the concepts participating in the mapping. This step is implemented through the Jena package written in Java language;
[0079] Ontology concept expansion: The conventional ontology concept is a single concept with low semantic information. For the ontology concepts parsed in the previous step, the semantic dictionary WordNet is used for expansion to improve the semantic information; as Figure 4 shown, the concepts obtained by Jena parsing lack semantic information, while the hypernyms and hyponyms in the semantic dictionary contain rich semantic information. Therefore, the semantic dictionary WordNet is used to expand the semantic information of the concepts to achieve the purpose of expanding the semantic information of the concepts. And at this time, the concepts can be regarded as a sample with multiple variables, which is convenient for subsequent classification using the constructed weighted Naive Bayes classifier;
[0080] Construct a weighted Bayesian classifier: By introducing a dynamic weight mechanism to reduce the influence of the conditional attribute independence assumption of the Naive Bayes classifier on the classification results, so as to improve the classification accuracy;
[0081] Calculate the prior probability;
[0082] Initialize the relevant parameters of the harmony search algorithm;
[0083] Set the objective function: The training samples of the Naive Bayes classifier are all samples with known categories. Therefore, the Naive Bayes classifier belongs to supervised clustering. Set the classification error rate as the objective function and continuously iterate through this objective function until the optimal weights are obtained;
[0084] Calculate the globally optimal weights through the harmony search algorithm: This process is described below;
[0085] Normalize the weights;
[0086] Calculate the posterior probability: Calculate the posterior probability using the prior probability calculated in step 4 and the weights normalized in step 8;
[0087] Complete the ontology mapping: First, take the expanded ontology concepts as data samples and input them into the weighted Bayes classifier. Then, classify the data samples according to the weighted Bayes classifier, that is, convert the ontology mapping problem into a classification problem. Suppose there is an ontology Onto1 and another ontology Onto2. There are x concepts in ontology Onto1 and y concepts in ontology Onto2. According to what is described in step S1, parse and expand the concepts of the two ontologies. The concepts in both ontologies can be regarded as samples with multiple attributes. Input these samples into the weighted Bayes classifier. The weighted Bayes classifier will calculate the probability that each concept in ontology Onto1 belongs to all concepts in ontology Onto2, and find the largest posterior probability among all posterior probabilities to complete the classification, that is, achieve the ontology mapping. For example, for a concept C in ontology Onto1 i , 1 ≤ i ≤ x, the weighted Bayes classifier will calculate the probability that concept C i belongs to all concepts C1, C2,..., C in ontology Onto2 y . Suppose the probability that concept C i belongs to concept C y is the largest. Then it can be considered that there is a mapping relationship between concept C i and concept C y . The ontology mapping method based on machine learning converts the mapping problem into a classification problem. The problem of choosing the optimal mapping for a certain concept is converted into the problem of classifying it, thus completing the ontology mapping.
[0088] The Naive Bayes classifier converts the ontology mapping into classification and finally completes the classification through the calculated maximum posterior probability and outputs the mapping result.
[0089] The above process is the main step of the present invention. Among them, the harmony search algorithm is used to optimize the Naive Bayes classifier. The classification error rate is set as the objective function and iterated continuously, so as to calculate the globally optimal weight, assign it to each attribute of the training samples of the Naive Bayes classifier, and construct a weighted Naive Bayes classifier, thereby reducing the impact brought by the independent assumption of the attributes of the Naive Bayes classifier and improving the classification accuracy. Combined with Figure 5 , the process of the harmony search algorithm is as follows:
[0090] Step 1: Initialize the relevant parameters of the harmony search algorithm: First, it is necessary to determine the objective function of the problem to be solved. Through the objective function, the generated solution can be judged to see if the generated solution is optimal. In addition, other parameters required by the harmony search algorithm also need to be initialized, such as the upper and lower limits of the solution space, the harmony memory considering rate (HMCR), the pitch adjusting rate (PAR), and the pitch adjustment bandwidth (BW), etc.;
[0091] Step 2: Randomly generate a number r1 between 0 and 1;
[0092] Step 3: Generate a new solution: Judge whether the randomly generated r1 is greater than the harmony memory considering rate HMCR. If it is greater, the generated variable will be randomly selected from the harmony memory, and the variable will be fine-tuned with a certain probability; if it is less, the variable will be randomly generated in a pre-set solution space with upper and lower limits;
[0093] Step 4: Judge whether n variables are generated: n is a parameter set in Step 1, and its specific meaning is the number of variables. If n variables are not generated, it will jump to Step 2 until n variables are generated and then enter the next step;
[0094] Step 5: Judge the generated new solution: Substitute the generated new solution into the objective function for solution, and then compare it with the worst solution in the harmony memory. According to the comparison result, perform corresponding steps. If the generated new solution is better than the worst solution in the harmony memory, then replace the poor solution with the generated new solution, that is, update the harmony memory; otherwise, discard it and do not update the harmony memory;
[0095] Step 6: Judge whether the stop iteration condition is satisfied: If the stop iteration condition is not satisfied yet, jump to Step 2 and repeat Steps 2 to 6 until the stop iteration condition is satisfied;
[0096] Output the result.
[0097] In the improvisation stage of the harmony search algorithm, a new solution is randomly generated from the harmony memory library and there is a certain probability of fine-tuning. Since it is difficult to find a suitable value for the parameter BW and the generated new solution has no fixed direction, with strong randomness, it will affect the optimization ability of the algorithm. To address this problem, the present invention provides a new way to generate new solutions, thereby reducing the use of parameters, optimizing the work of initializing related parameters of the algorithm, and improving the optimization ability of the algorithm. Combining Figure 6 , the new way of generating solutions proposed by the present invention makes the generated new solution move towards the optimal solution in the harmony memory library while moving in the opposite direction of the worst solution. The specific expression is as follows:
[0098] new_x=new_x - x r +x r
[0099] =random1×(x best -x r )+(-random2×(x worst -x r ))+x r
[0100] =x r +random1×(x best -x r )-random2×(x worst -x r )
[0101] In summary, through the specific description of the above embodiments, those skilled in the art can clearly understand the implementation steps, and thus can implement them by themselves with the required software and hardware platforms. The present invention designs a weight Bayesian classifier and ontology mapping method for semantic ontology. This method uses the naive Bayesian classifier in the field of machine learning to convert the ontology mapping problem into a classification problem. Compared with the commonly used ontology mapping method based on semantic similarity, the mapping algorithm proposed by the present invention has a higher accuracy rate and can avoid the use of thresholds, reducing the labor cost. To simplify the problems brought by the attribute independence assumption proposed by the naive Bayesian classifier, the present invention introduces a weighted naive Bayesian classifier, sets the classification error rate as the objective function, and uses the harmony search algorithm to iterate continuously, and finally calculates the globally optimal weight. In the context of the rapid development of the semantic Internet of Things, more and more heterogeneous ontologies appear, which cause great obstacles to the interoperability between various heterogeneous ontologies. The original intention of establishing an ontology is to share knowledge, but it is still very difficult to establish a large global general ontology. Therefore, the weight Bayesian classifier and ontology mapping method for semantic ontology proposed by the present invention can, to a great extent, solve the problem of difficult interoperability between heterogeneous ontologies.
[0102] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0103] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0104] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0105] The above embodiments should be understood to be only used to illustrate the present invention and not to limit the protection scope of the present invention. After reading the contents of the present invention, technicians can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A weighted Bayesian classifier and ontology mapping method for semantic ontology, characterized in that It includes the following steps: S1: Parse the ontology: First, use Jena to parse the ontologies participating in ontology mapping to obtain the concepts of the ontology. At this time, the concepts lack semantic information. Use the hypernyms and hyponyms in the semantic dictionary WordNet to expand the ontology concepts to improve the semantic information of the ontology concepts. And at this time, the ontology concepts can be regarded as a sample with multiple variables, which is convenient for subsequent classification using the weighted Bayesian classifier, so as to realize that the problem of selecting the optimal mapping for a certain concept is converted into the problem of classifying it; S2: Determine the weights: To simplify the calculation of posterior probabilities, the naive Bayesian classifier proposes the "attribute conditional independence assumption". This assumption believes that all attributes of the sample are independent of each other. However, in real classification tasks, it is difficult to meet this assumption, which affects the classification results. To reduce the impact brought by this assumption, a weighted Bayesian classifier is introduced, and corresponding weights are assigned to each attribute in the sample to represent the influence degree of each attribute on the classification result. The expression is as follows: where P(c i |x) represents the probability that the sample x belongs to the class c i , P(c i ) is the prior probability, P(x) is the likelihood probability, a j represents the j-th attribute in the sample x, w(j) represents the weight of the j-th attribute in the sample x, used to represent the influence degree of this attribute on the classification result, n is the number of attributes in the sample x, and P(a j |c i ) is the conditional probability; S3: Construct a weighted Bayesian classifier: Establish a weighted Bayesian classifier through the weights obtained in the previous step; S4: Ontology mapping process based on the weighted Bayesian classifier: Ontology mapping, also called ontology matching or ontology alignment, refers to establishing conceptual associations and matches between two heterogeneous ontologies; converting the ontology mapping problem into a classification problem through constructing a weighted Bayesian classifier; the problem of finding the best mapping relationship for a certain concept is converted into the problem of classifying it; Suppose there is an ontology Onto1 and another ontology Onto2. There are x concepts in ontology Onto1 and y concepts in ontology Onto2; Parse and expand the concepts of the two ontologies. The concepts in the two ontologies can be regarded as samples with multiple attributes. Input these samples into the weighted Bayesian classifier. The weighted Bayesian classifier will calculate the probability that each concept in ontology Onto1 belongs to all concepts in ontology Onto2, and find the largest posterior probability among all posterior probabilities to complete the classification, that is, realize ontology mapping.
2. The weight Bayesian classifier and ontology mapping method for semantic ontology according to claim 1, characterized in that The step S1 completes the parsing of the ontologies participating in ontology mapping through the Jena package in Java, extracts the concepts, and uses the semantic dictionary WordNet to complete the expansion of the concepts. Specifically, it includes the following steps: S11: Import the Jean package: Jena is an open-source tool of the Semantic Web Research Project Group of HP Labs and is a Java-based semantic web application framework. Through Jena, the ontologies to be input are parsed, and the concepts therein are extracted and saved; S12: Concept expansion: The concepts parsed in step S11 are single concepts and lack semantic information. The hypernyms and hyponyms in the semantic dictionary WordNet contain rich semantic information, which can be used to expand the concepts, enhance the semantic information of the concepts, and at the same time the concepts become a sample with multiple attributes.
3. A weight Bayesian classifier and ontology mapping method for semantic ontology according to claim 1, characterized in that, The step S2 uses the harmony search algorithm to determine the weights: Introduce a dynamic weight mechanism. The specific steps are as follows: S21: Determine the evaluation function: The training samples used for the classification of the Naive Bayes classifier contain the classification categories, which belongs to supervised clustering. The classification error rate is used as the evaluation function, and the expression is as follows: f(x) = 1 - accuracy_rate where accuracy_rate is the classification accuracy rate, which can be calculated from the training samples of the Naive Bayes classifier; S22: Initialize the relevant parameters of the harmony search algorithm according to relevant rules, and set each harmony as the weight corresponding to the sample attributes; S23: Generate a new solution in a new way: In the form of a vector, while making the generated new solution move towards the direction of the optimal solution in the harmony memory library, move in the opposite direction of the worst solution in the harmony memory library; S24: Judge whether to accept the generated new solution: Judge through the evaluation function. If the currently generated new solution is better than the worst solution in the harmony memory library, then replace the worst solution in the memory library with the generated new solution. If this solution is worse than the worst solution in the current memory library, then accept this solution with a certain probability, and this probability gradually decreases with the number of iterations; S25: Judge whether the iteration stop condition is satisfied: If the iteration stop condition is not satisfied, continue to generate new solutions for judgment. If the iteration stop condition is satisfied, output the calculated weight value.
4. A weight Bayesian classifier and ontology mapping method for semantic ontology according to claim 3, characterized in that The harmony search algorithm in step S22 specifically includes: Step 1: Initialize the relevant parameters of the harmony search algorithm: First, the objective function of the problem to be solved must be determined. Through the objective function, the generated solutions can be judged to see if the generated solutions are optimal. In addition, other parameters required for the harmony search algorithm also need to be initialized, including the upper and lower limits of the solution space, the harmony memory consideration rate HMCR, the pitch adjustment rate PAR, and the pitch adjustment bandwidth BW parameters; Step 2: Randomly generate a number r1 between 0 and 1; Step 3: Generate a new solution: Judge whether the randomly generated r1 is greater than the harmony memory consideration rate HMCR. If it is greater, the generated variable will be randomly selected from the harmony memory library, and the variable will be fine-tuned with a certain probability. If it is less, the variable will be randomly generated in a pre-set solution space with upper and lower limits; Step 4: Judge whether n variables are generated: n is a parameter set in step 1, and its specific meaning is the number of variables. If n variables are not generated, it will jump to step 2 until n variables are generated and then enter the next step; Step 5: Judge the generated new solution: Substitute the generated new solution into the objective function for solution, and then compare it with the worst solution in the harmony memory library. Perform corresponding steps according to the comparison result. If the generated new solution is better than the worst solution in the harmony memory library, then replace the poor solution with the generated new solution, that is, update the harmony memory library. Otherwise, discard it and do not update the harmony memory library; Step 6: Judge whether the iteration stop condition is satisfied: If the iteration stop condition is not yet satisfied, jump to step 2 and repeat steps 2 to 6 until the iteration stop condition is satisfied; output the result.
5. A weight Bayesian classifier and ontology mapping method for semantic ontology according to claim 3, characterized in that, The specific steps of S23 include: while moving the newly generated solution towards the optimal solution in the harmony memory library, move it in the opposite direction of the worst solution. The specific expression is as follows: new_x = new_x - x r + x r = random1 × (x best - x r ) + (- random2 × (x worst - x r )) + x r = x r + random1 × (x best - x r ) - random2 × (x worst - x r ) where x r represents a solution randomly generated in the harmony memory library, and x best represents the optimal solution in the harmony memory library, and x worst represents the worst solution in the harmony search library. Random1 and Random2 are random numbers between 0 and 1, and new_x represents the newly generated solution.