A pressure instrument abnormality classification method based on BAdaCost algorithm
Through the pressure instrument abnormal classification method based on BAdaCost algorithm, the problem that traditional methods cannot effectively identify and classify complex and varied abnormal situations is solved, and higher classification accuracy and ability to deal with sample imbalance are achieved.
Patent Information
- Application Number
- CN202410271915.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-11
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-03-11
AI Technical Summary
During the differential pressure calibration process of traditional pressure instruments, complex and variable abnormal situations cannot be effectively identified and classified, resulting in the accuracy and credibility of calibration results.
The pressure instrument abnormal classification method based on the BAdaCost algorithm is adopted. By obtaining historical calibration monitoring parameters and manual annotation health status, training samples are constructed and an abnormal classification model is constructed using the improved BAdaCost algorithm to realize online detection of abnormal status.
This method can better deal with sample imbalance problem, improve the classification accuracy of fewer samples, and improve prediction accuracy by optimizing the anomaly classification model built by the decision tree.
Smart Images

Figure CN118152935B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pressure instruments, and in particular to a pressure instrument abnormality classification method based on a BAdaCost algorithm. Background Art
[0002] The calibration of instruments is an important step to ensure that their measurement results are accurate and reliable. In the differential pressure calibration process of pressure instruments, the identification and classification of abnormal conditions are crucial to ensure the accuracy and credibility of the calibration results. Traditional methods mainly rely on manual experience and rule formulation, but their limitations are that they cannot cope with complex and changeable abnormal conditions and the potential correlations behind the data. Summary of the invention
[0003] The invention discloses a pressure meter abnormality classification method based on BAdaCost algorithm, which can detect the abnormal state of the pressure meter online.
[0004] It is achieved through such a technical solution, the specific method is as follows:
[0005] Obtain historical pressure instrument calibration monitoring parameters and manually mark the health status of historical pressure instruments;
[0006] Construct training samples based on historical pressure instrument calibration monitoring parameters and corresponding historical pressure instrument health status;
[0007] The training samples are processed with the improved BAdaCost algorithm to build an anomaly classification model;
[0008] The calibration monitoring parameters of the pressure instrument to be classified are input into the abnormal classification model to obtain the abnormal classification.
[0009] Further, the pressure instrument calibration monitoring parameters include: leakage current, insulation resistance value and actual voltage value measured at each pressure value, expressed as x;
[0010] The manually annotated historical pressure instrument health status is represented as l.
[0011] Furthermore, the training samples are processed to build an abnormal classification model. The specific method is as follows:
[0012] Use decision tree as weak learner to fit the sample set in training sample;
[0013] Optimizing decision tree weak learners;
[0014] The strong learner, i.e. the anomaly classification model, is constructed using all the optimized decision tree weak learners.
[0015] Furthermore, the decision tree is used as a weak learner to fit the sample set in the training sample. The specific method is as follows:
[0016] Initialize the sample set {(x n ,l n The weight value of each sample in )} is calculated as follows:
[0017]
[0018] Use decision tree as weak learner to fit sample set {(x n ,l n )}, the weak learner's attention to each sample is determined according to the sample weight value, and the fitting process of the weak learner is expressed as:
[0019]
[0020] Among them, g m represents the weak learner after fitting, θ m represents the model structure parameters of the weak learner, m is the sequence number of the weak learner, the initial value is 1, and N is the total number of samples in the sample training set.
[0021] Further, optimize the decision tree weak learner. The specific steps are as follows:
[0022] Calculate the cost matrix based on the prediction results of the weak learner;
[0023] Calculate the performance matrix based on the cost matrix;
[0024] According to the performance matrix, calculate the weight of the weak learner;
[0025] According to the weight of the weak learner, re-assign the weight value of each sample set.
[0026] Furthermore, the cost matrix is calculated based on the prediction results of the weak learner. The specific method is as follows:
[0027] According to the weak learner g m The prediction results calculate the cost matrix C∈R K×K , which is used to represent the misclassification cost of different samples, where K represents the total number of health status categories. The misclassification cost matrix can be expressed as follows:
[0028]
[0029] Furthermore, the performance matrix is calculated according to the cost matrix. The specific method is as follows:
[0030] Computational performance * Matrix, c * The diagonal element value of the matrix is the negative sum of all elements of the corresponding row of the cost matrix C, which represents the negative cost associated with the correct classification and is regarded as a reward value for the classifier's correct classification;
[0031] c* The matrix calculation formula is as follows:
[0032]
[0033] Further, according to the performance matrix, the weak learner g is calculated m The weight β m , the specific formula is as follows:
[0034]
[0035] Among them, S j Indicates that sample n is actually of class j and weak learner g m The sum of the sample weights when classified into class j is calculated as:
[0036]
[0037] E j,k Indicates that sample n is actually of class j but classifier g m The sum of the sample weights classified as other classes is calculated as follows:
[0038]
[0039] Furthermore, according to the weight of the weak learner, the weight value of each sample set is reassigned. The specific method is as follows:
[0040] According to the classification of each sample by the weak learner, the sample weight value w(n) is updated, and the calculation formula is:
[0041] w(n)=w(n)·exp(-β m ·l n ·g m (x n ))
[0042] Furthermore, all the optimized decision tree weak learners are used to construct a strong learner. The specific method is as follows:
[0043] M weak learners After integration, a strong learner H(x) is obtained. The calculation formula of model integration is as follows:
[0044]
[0045] Due to the adoption of the above scheme, this application has the following beneficial effects:
[0046] 1. It can better handle the problem of sample imbalance because it adjusts the weights of samples during training to improve the classification accuracy of fewer samples.
[0047] 2. The anomaly classification model is constructed by several optimized decision trees. Compared with random forests, the model prediction accuracy is higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings of the present invention are as follows.
[0049] Figure 1 Differential pressure calibration fault monitoring page for pressure instruments.
[0050] Figure 2 This is a schematic diagram of the differential pressure calibration fault test of the pressure instrument.
[0051] Figure 3 It is a schematic diagram of the process of the present invention.
[0052] Figure 4 Schematic diagram of the process of building an anomaly classification model. DETAILED DESCRIPTION
[0053] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0054] A pressure instrument abnormality classification method based on BAdaCost algorithm, such as Figure 3 As shown, the specific steps are as follows:
[0055] S1. Obtain historical pressure instrument calibration monitoring parameters and manually mark the historical pressure instrument health status.
[0056] Specifically, the pressure instrument calibration monitoring parameters include: leakage current, insulation resistance value and actual voltage value measured at each pressure value, represented as x; and manually annotated historical pressure instrument health status represented as l.
[0057] S2, construct training samples {(x n ,l n )}.
[0058] S3, process the training samples with the improved BAdaCost algorithm and build an abnormal classification model, such as Figure 4 shown.
[0059] In order to ensure the originality of the data and reduce the complexity of the algorithm, the original data set is directly used as the input parameter without normalization and standardization. The traditional classification model assumes that all misclassifications have the same cost, while the cost-sensitive model believes that the costs between different classification models and different samples are different. Cost-sensitive learning takes into account the misclassification costs between different samples, and its purpose is to reduce the total cost as much as possible while ensuring a certain classification accuracy.
[0060] Specifically, the training samples are processed and the anomaly classification model is constructed. The specific method is as follows:
[0061] S31. Use the decision tree as a weak learner to fit the sample set in the training sample.
[0062] Specifically, the decision tree is used as a weak learner to fit the sample set in the training sample. The specific method is as follows:
[0063] S311, initialize the sample set {(x n ,l n The weight value of each sample in )} is calculated as follows:
[0064]
[0065] S312, using decision tree as weak learner to fit sample set {(x n ,l n )}, the weak learner's attention to each sample is determined according to the sample weight value, and the fitting process of the weak learner is expressed as:
[0066]
[0067] Among them, g m represents the weak learner after fitting, θ m represents the model structure parameters of the weak learner, m is the sequence number of the weak learner, the initial value is 1, and N is the total number of samples in the sample training set.
[0068] S32. Optimize decision tree weak learner.
[0069] Specifically, the steps for optimizing the decision tree weak learner are as follows:
[0070] S321. Calculate the cost matrix according to the prediction results of the weak learner.
[0071] In step S321, according to the weak learner g m The prediction results calculate the cost matrix C∈R K×K , which is used to represent the misclassification cost of different samples, where K represents the total number of health status categories. The misclassification cost matrix can be expressed as follows:
[0072]
[0073] S322. Calculate a performance matrix according to the cost matrix.
[0074] In step S322, c is calculated * Matrix, characterized by c *The diagonal element value of the matrix is the negative sum of all elements of the corresponding row of the cost matrix C, which represents the negative cost associated with the correct classification and can be regarded as the reward value for the correct classification of the classifier. Specifically, c * The calculation rules of the matrix are as follows:
[0075]
[0076] S323. Calculate the weight of the weak learner according to the performance matrix.
[0077] In step S323, the weak learner g is calculated based on the performance of the weak learner. m The weight β m , the calculation formula is as follows:
[0078]
[0079] Where S j Indicates that sample n is actually of class j and weak learner g m The sum of the sample weights when classified into class j is calculated as follows:
[0080]
[0081] E j,k Indicates that sample n is actually of class j but classifier g m The sum of the sample weights classified as other classes is calculated as follows:
[0082]
[0083] S324: Re-assign a weight value to each sample set according to the weight of the weak learner.
[0084] In step S324, the sample weight value w(n) is updated according to the classification of each sample by the weak learner. If the probability of sample w(n) being misclassified is very high, then the weight of the sample needs to be increased to establish the sensitivity of the model to the sample, that is, cost sensitivity. The calculation formula for updating the sample weight value is as follows:
[0085] w(n)=w(n)·exp(-β m ·l n ·g m (x n ))
[0086] S325, repeat S321 to S324, m increases by +1 successively, and stops when the total number of weak learners M is reached. At the end of the training, a total of M weak learners are generated, which is expressed as
[0087] S33. Construct a strong learner, i.e., an abnormal classification model, using all the optimized decision tree weak learners.
[0088] In step S33, M weak learners are After integration, a strong learner H(x) is obtained. The calculation formula of model integration is as follows:
[0089]
[0090] S4. Input the calibration monitoring parameters of the pressure instrument to be classified into the abnormal classification model to obtain the abnormal classification.
[0091] Simulation comparison:
[0092] Compared with random forest, BAdaCost algorithm has good performance in the evaluation indicators of accuracy ACC, recall REC, Weighted-F1 and error cost Loss, which shows that BAdaCost algorithm performs well in improving the accuracy of classifier, and can pay attention to the error cost of different categories based on the cost matrix and reflect it in the algorithm. The algorithm model evaluation table is as follows:
[0093]
[0094] In order to realize the calibration fault monitoring of pressure instruments, a pressure instrument classification test system is designed. Figure 1 and Figure 2 As shown. Both use SpringBoot and Vue front-end and back-end separation architecture, and the system startup and response speed are fast, reaching the second level. The system regularly reads data through ModBus to store data, and displays the real-time data of various parameters in the flow calibration process through the Echart table in real time, which can meet the collection frequency required by the project. The trained anomaly diagnosis model is applied to the platform to diagnose and monitor the real-time operation data. Once the system diagnoses an anomaly or predicts that an anomaly will occur, the platform will display the abnormal data and anomaly classification on the platform through the web page and back up and record this information.
[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A pressure instrument abnormality classification method based on BAdaCost algorithm, characterized in that: The specific method is as follows: Obtain historical pressure instrument calibration monitoring parameters and manually mark the health status of historical pressure instruments; Construct training samples based on historical pressure instrument calibration monitoring parameters and corresponding historical pressure instrument health status; The training samples are processed with the improved BAdaCost algorithm to build an anomaly classification model; Input the calibration monitoring parameters of the pressure instrument to be classified into the abnormal classification model to obtain the abnormal classification; The pressure instrument calibration monitoring parameters include: leakage current, insulation resistance value and actual voltage value measured at each pressure value, expressed as x; The health status of the manually annotated historical pressure instrument is represented as l; Process the training samples and build an anomaly classification model. The specific methods are as follows: Use decision tree as weak learner to fit the sample set in training sample; Optimizing decision tree weak learners; Use all the optimized decision tree weak learners to build a strong learner, i.e., anomaly classification model; Using decision tree as weak learner, fit the sample set in training sample. The specific method is as follows: Initialize the sample set {(x n ,l n The weight value of each sample in )} is calculated as follows: Use decision tree as weak learner to fit sample set {(x n ,l n )}, the weak learner's attention to each sample is determined according to the sample weight value, and the fitting process of the weak learner is expressed as: Among them, g m represents the weak learner after fitting, θ m represents the model structure parameter of the weak learner, m is the sequence number of the weak learner, the initial value is 1, and N is the total number of samples in the sample training set; Optimize the decision tree weak learner. The specific steps are as follows: Calculate the cost matrix based on the prediction results of the weak learner; Calculate the performance matrix based on the cost matrix; According to the performance matrix, calculate the weight of the weak learner; Re-assign the weight value of each sample set according to the weight of the weak learner; The cost matrix is calculated based on the prediction results of the weak learner. The specific method is as follows: According to the weak learner g m The prediction results calculate the cost matrix C∈R K×K , which is used to represent the misclassification cost of different samples, where K represents the total number of health status categories; the misclassification cost matrix can be expressed as follows: The performance matrix is calculated based on the cost matrix. The specific method is as follows: Computational performance * Matrix, c * The diagonal element value of the matrix is the negative sum of all elements of the corresponding row of the cost matrix C, which represents the negative cost associated with the correct classification and is regarded as a reward value for the classifier's correct classification; c * The matrix calculation formula is as follows: According to the performance matrix, calculate the weak learner g m The weight β m , the specific formula is as follows: Among them, S j Indicates that sample n is actually of class j and weak learner g m The sum of the sample weights when classified into class j is calculated as: E j,k Indicates that sample n is actually of class j but classifier g m The sum of the sample weights classified as other classes is calculated as follows: According to the weight of the weak learner, re-assign the weight value of each sample set. The specific method is as follows: According to the classification of each sample by the weak learner, the sample weight value w(n) is updated, and the calculation formula is: w(n)=w(n)·exp(-β m ·l n ·g m (x n ))。 2. The pressure instrument abnormality classification method based on BAdaCost algorithm according to claim 1 is characterized in that: The strong learner is constructed with all the optimized decision tree weak learners. The specific method is as follows: M weak learners After integration, a strong learner H(x) is obtained. The calculation formula of model integration is as follows: 。