Electrocardiosignal recognition and diagnosis method based on composite machine learning

By constructing a composite machine learning model that combines random forest, BP neural network and SVM support vector machine, the problem of low efficiency in ECG signal diagnosis is solved, and high-precision identification of ECG abnormality types is achieved, especially the accurate classification of types such as left bundle branch block, right bundle branch block and ventricular escape beat.

CN116628579BActive Publication Date: 2026-03-24HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Current technologies for diagnosing cardiac signals are inefficient, especially given the diversity of arrhythmia types and the complexity of pathological conditions, which leads to generally low diagnostic efficiency for doctors. Furthermore, traditional machine learning methods are inadequate in terms of feature extraction and noise filtering.

Method used

A composite machine learning approach was adopted, combining random forest model, BP neural network and SVM support vector machine. Through feature extraction and decision tree voting mechanism, an electrocardiogram signal recognition and diagnosis system was constructed, and the system was trained and validated using the MIT-BIH arrhythmia database.

Benefits of technology

The improved model improved the accuracy of ECG signal recognition and diagnosis. Experimental results showed that the accuracy of the improved model reached 98.3%, effectively improving the accuracy of ECG abnormality identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116628579B_ABST
    Figure CN116628579B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of machine learning, and particularly relates to a composite machine learning method-based electrocardiosignal recognition diagnosis method, which comprises: in a traditional random forest model, a total membership relationship between a random forest and multiple decision tree models; through an improved random forest model, a BP neural network and a SVM support vector machine model are added to a parallel layer with the decision trees and also serve as a part of the random forest; when a calculation result is obtained, the decision trees cooperate with the two models to jointly vote to determine a final result, and electrocardiosignal recognition diagnosis is realized. Experimental results show that the improved algorithm has an accuracy of 98.3%, and effectively realizes electrocardiosignal recognition diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electrocardiogram signal classification and diagnosis, specifically a method for detecting abnormal heartbeats based on composite machine learning. Background Technology

[0002] An electrocardiogram (ECG), as a comprehensive representation of human cardiac activity, contains rich physiological and pathological information through electrical conduction signals extracted from the heart rhythm. Generally, human ECG signals are collected by electrocardiogram (ECG) machines in hospitals, and medical staff manually observe them using their knowledge of cardiovascular disease diagnostic rules and clinical experience to arrive at a diagnosis. However, because different patients have significantly different heartbeat patterns, and the ECG patterns for the same disease can vary greatly, manually analyzing ECG waveforms by doctors would undoubtedly be a huge test of their professional medical knowledge and clinical experience. Due to the diversity of arrhythmia types and the complexity of actual pathological conditions, the efficiency of doctors in making accurate diagnoses using ECGs is generally low.

[0003] With the rapid development of electronic information technology and computer technology, machine learning has become an indispensable and important part of modern medicine. Meanwhile, electrocardiogram (ECG) professionals both domestically and internationally have proposed various methods for classifying heart rhythms. Currently, the mainstream classifications include: left bundle branch block, right bundle branch block, premature ventricular contractions (PVCs), ventricular escape beats, and so on. Considering simplification and ease of expression, this invention selects four heart rhythm types—normal ECG, left bundle branch block, right bundle branch block, and ventricular escape beats—for classification and identification, and represents them respectively with N, L, R, and H.

[0004] The most important task is to employ a computer-compatible processing method to characterize the various features in electrocardiogram (ECG) images—that is, feature extraction. Currently, deep learning neural networks in machine learning are quite advantageous in the field of ECG signal recognition and diagnosis, possessing excellent feature extraction and classification capabilities. However, verification results show that after manually extracting ECG signal features, the classification results obtained by traditional machine learning methods for identification and diagnosis are no less than, and even slightly superior to, the classification capabilities of deep learning. Therefore, it is crucial to manually obtain good information in terms of noise filtering and feature extraction.

[0005] Abstract and Figure Analysis:

[0006] The overall framework of this patent is to construct a composite random forest model, which will be discussed below. Figure 10Let's explain each module of the model one by one: When classifying and diagnosing a specific heartbeat sample, each module—a decision tree in a random forest (four decision trees in total), a backpropagation neural network, and an support vector machine (SVM)—is used to identify the heartbeat and produce its own diagnosis (e.g., Y1=L, Y2=R, Y3=L, Y4=L, Y5=L, Y6=N). These results are then voted on, and the diagnosis with the most frequent output (L in this example) is identified as the final result: the ECG abnormality type of this heartbeat is L (left bundle branch block).

[0007] Regarding the decision tree model in the diagram, taking decision tree 1 as an example: First, the X1, X2, and X3 of a certain heartbeat are provided as input to decision tree 1 (assuming X1 = A1, X2 = A2, X3 = A3). In the first pentagram section, feature filtering is performed on the input data: when X1 > B1, the classification process of decision tree 1 terminates, and decision tree 1 diagnoses the ECG abnormality type of this heartbeat as... Conversely, the data is passed to the leaf nodes for further comparison. When X2 > B2, the classification process of decision tree 1 is terminated, and decision tree 1 diagnoses the ECG abnormality type of this heartbeat as... Conversely, the data is passed to the next leaf node for comparison: when X3 > B3, the classification process of decision tree 1 is completely terminated, and decision tree 1 diagnoses the ECG abnormality type of this heartbeat as... Conversely, the diagnostic type is After the above process, there will be four possible outcomes. Choose one from them as the final output Y1.

[0008] For the BP neural network model in the diagram: First, the X1X2X3X4 of a certain heartbeat is provided as input to the BP neural network model. After training through the hidden layers and intermediate neurons using the backpropagation algorithm, and through training with samples, a reasonable neural network is finally trained. When the X1X2X3X4 of a heartbeat is provided as input to this neural network, the abnormal type Y5 of the heartbeat electrocardiogram signal will be obtained.

[0009] For the SVM support vector machine model in the figure: First, select an appropriate number of heartbeats (X1, X2, X3, X4) as input to the SVM. By setting a suitable kernel function, transform it into an easily separable high-dimensional space. Set the soft boundary as the loss function, find a hyperplane to achieve binary classification, and then proceed in this way to build SVMs for each of the four heartbeat categories. Finally, when classifying the test samples, select the category with the largest proportion of samples. Considering there are four classification results, this is a four-class classification model. However, traditional support vector machines are binary classification problems, so we use a one-to-one approach to solve this problem: there are four heartbeat categories, and the number of SVM models needed is... That is, six Support Vector Machine (SVM) models. This method involves building an SVM model for each of the multiple classes and the remaining classes one by one, classifying the test samples, and finally assigning the test samples to the class with the largest number of votes, similar to a voting process; the class with the most votes is assigned to the test samples. For example, for... Figure 10 In the SVM model on the right, the binary classification problem of SVM 1 compares the types of ECG abnormalities N and L (normal ECG and left bundle branch block). The final result is y = +1 (meaning the final result is N, and conversely, when y = -1, the result is L). After pairwise comparison, it can be seen from these six SVM results that the test sample has three votes classified as N, while L, R, and H each have one vote. Therefore, the test sample is classified as N, so the final result of the SVM model is that the sample is classified as normal ECG.

[0010] After the classification results of the above three models are obtained, the decision tree, BP neural network and SVM support vector machine are combined into a special random forest, and their results are voted to finally obtain the classification result. Summary of the Invention

[0011] Purpose of the Invention: The purpose of this invention is to provide a method for electrocardiogram (ECG) signal recognition and diagnosis based on composite machine learning. By improving the traditional random forest model, and drawing on the method of determining the result through voting in the "decision tree" under the random forest, a backpropagation neural network and a support vector machine (SVM) are added to improve the accuracy of ECG signal recognition and diagnosis using the traditional decision tree-random forest model.

[0012] Technical solution: The specific steps of this invention are as follows:

[0013] S1: Download data. Search and download the MIT-BIH arrhythmia database to prepare for training the composite machine learning system using the classification results and datasets provided therein.

[0014] S2: Read the electrocardiogram signal and obtain the horizontal and vertical coordinates of each detection point through the .dat file; obtain the manual annotation type of each heartbeat through the .atr file.

[0015] S3: Further preprocess the data by using MATLAB software to perform wavelet denoising on the ECG signal, and then dividing it into units based on individual heartbeats. This method can address the problem of ECG signal distortion and preserve accurate features for subsequent identification of ECG abnormality types.

[0016] S4: ECG signal feature extraction. After accurately segmenting each heartbeat, corresponding features can be extracted for each heartbeat. Here, the interval length of each heartbeat is X1, the R-wave peak height is X2, the length of a single R-wave range is X3, and the steepness of the R-wave (slope) is X4.

[0017] S5: Construct a decision tree model. Choose any three features from the four categories mentioned above to form a decision tree. The decision tree will learn a classifier. This classifier classifies based on the given features and can correctly classify a given sample.

[0018] S6: A backpropagation (BP) neural network that takes the above four features as input and outputs the ECG abnormality type for each heartbeat. This set of data is considered a single sample. This process is repeated to extract 8160 heartbeats as 8160 samples for training. Of these, 70% are selected as training samples and 30% as test samples.

[0019] S7: Support Vector Machine (SVM) maps the original features X1X2X3X4 using a kernel function to establish a new high-dimensional space. The soft boundary is then used as the loss function. By continuously calculating the loss function, the optimal three-dimensional space is found to achieve binary classification. This process is repeated to build SVMs for each of the remaining classes. When classifying test samples, the sample is finally assigned to the class with the largest percentage of samples.

[0020] S8: A composite random forest that treats the BP neural network and support vector machine as ordinary decision trees in a traditional random forest, together with the decision trees in S5, as "decision trees" in a new random forest, and jointly votes to determine the type of each heartbeat.

[0021] In step S1, the dataset used in this experiment is the MIT-BIH arrhythmia database provided by MIT. The MIT-BIH arrhythmia database contains a large amount of data and has been annotated and labeled in detail by authoritative experts, making it the most widely used database for arrhythmia classification and clinical research. This database includes over 4,000 24-hour periodic ambulatory electrocardiogram (ECG) data points from 48 individual test units, with 48 recording files approximately 30 minutes long, totaling 109,500 heartbeats, of which abnormal heartbeats account for approximately 30%.

[0022] In step S2, MATLAB will be used to read and process the three types of files contained in each test individual. The .hea file is the header file, which records the patient's overall information, such as age and medication; the .dat file is the data file, which contains the stored signals of the two leads; and the .atr file is the annotation file, which contains the manually marked location and type of manual annotation for each heartbeat.

[0023] In step S3, wavelet denoising involves combining wavelet transform with thresholding to process the ECG signal. The main function of wavelet transform is to scale and shift the wavelet function over time, enabling multi-scale time-frequency local analysis of non-stationary signals. This method can refine the signal temporally at high frequencies or points of abrupt changes, and refine the signal frequency at low frequencies or points of slow variation. It achieves both high-frequency and low-frequency image processing capabilities simultaneously.

[0024] Thresholding mainly involves selecting the threshold and the threshold function. Regarding threshold selection, we set λ as the threshold value. The choice of λ's value is crucial; a threshold that is too high will cause signal distortion, while a threshold that is too low will result in incomplete denoising. Here, we choose Stein unbiased likelihood estimation as the threshold, which is an adaptive threshold selection method. It calculates the corresponding risk value for each threshold, and the threshold with the lowest risk is considered reasonable. Regarding the threshold function, we set ω as the wavelet coefficient, which is used to determine ω.

[0025] In the final wavelet coefficient reconstruction section, we select soft thresholding as the processing method, and the specific formula is as follows:

[0026]

[0027] In step S4, for feature extraction, considering that the main ECG features are contained in the R wave, we mainly select some features of the R wave for extraction, such as interval length and peak height. In steps S2 and S3, we obtained the horizontal and vertical coordinates of each extraction point, i.e., the time point and ECG voltage value of each sampling point. These are time and V, respectively. We also obtained the position of the R wave peak for each R wave. (peak is a numerical value; for example, the R wave peak of the nth heartbeat occurs at time(peak), and its ECG voltage value is V(peak).)

[0028] The length of the central beat is 301 sample points, which are 150 sample points before and after the peak. The time length of the nth central beat is: X1(n) = time(peak(n) + 150) - time(peak(n) - 150).

[0029] The expression for the peak height of each R-wave is: X2(n) = V(peak(n))

[0030] In step S5, after extracting the features of each heartbeat, considering the greatest advantage of decision trees—their inherent interpretability—we use the decision tree as the first model to diagnose and identify the classification result of that heartbeat. This is a process of selection based on certain conditions to achieve a goal. Given that the final framework is a random forest model, to avoid overfitting in the decision trees, we need to remove one feature from each decision tree and retain the remaining three. Since there are four features in total, we can construct four decision trees. To measure the performance of the decision trees, we use entropy. In a decision tree, entropy represents the richness of sample types within the same branch. The more sample types, the greater the entropy; the more chaotic the branch, the worse the training effect. Therefore, the construction strategy for decision trees is to rapidly reduce entropy as the tree depth (i.e., the number of layers) increases. The faster the entropy decreases, the higher the classification efficiency of the decision tree.

[0031] In step S6, the BP neural network is a multi-layer feedforward neural network that calculates network error through feedforward and then updates network weights through backpropagation, employing a supervised learning method. To maximize model accuracy, unlike decision trees which delete a feature, the four features need to be integrated into a single vector. Each heartbeat sample corresponds to a four-dimensional vector as the sample input, while the sample output Y represents the diagnostic type of the ECG signal: N, L, R, H.

[0032] In step S7, Support Vector Machine (SVM) is a supervised learning binary classification model, which can be abstracted as a four-class classification model in our model. Its main purpose is to find a hyperplane to segment the sample data, thus transforming it into a convex quadratic programming problem. The SVM model uses a nonlinear kernel function to transform the classification task from a linearly inseparable low-dimensional space to a linearly separable high-dimensional space. Then, it uses algorithmic analysis to find the optimal hyperplane and finally returns to the original space to obtain the solution for the initial space.

[0033] In step S8, after all three models have been modeled, to further improve the accuracy of sample recognition, we choose the Random Forest model to integrate the three. Since each of the three models inevitably has strengths in some aspects but weaknesses in others, integrating them under the Random Forest model results in a stable model that performs well in all aspects. Figuratively speaking, this is an ensemble learning model that can overcome stronger challenges with weaker elements. Traditional Random Forest models are based on a series of decision trees, while this patent replaces some of these decision trees with BP neural networks and SVM support vector machines. The significance of "random" lies in the fact that the four decision trees are trained on a subset of features randomly sampled from the dataset, meaning they take different perspectives. The final classification structure is determined through voting. (For example, if the diagnostic structures of the four decision trees, neural network, and support vector machine for a specific heartbeat are N, L, L, H, L, L, then because the model with the result L is more frequent during the voting process, the final diagnosis will be L, i.e., left bundle branch block).

[0034] Finally, to measure the effectiveness of this patent, we need to introduce quantifiable criteria: the arrhythmia classification algorithm of this patent is a four-class classification problem, but for any single class, it is essentially a binary classification problem, i.e., whether it belongs to this class. Therefore, we first introduce the binary classification model:

[0035] For binary classification problems, each sample can be divided into four cases: true positive (TP), false positive (FP), true negative (TN), and true negative (FN). Let TP, FP, TN, and FN represent the number of samples corresponding to each case. Then, TP + FP + TN + FN = the total number of samples. The confusion matrix of the classification result is then:

[0036]

[0037] Since this is a four-class classification problem, to facilitate its explanation, we need to map TP, FP, TN, and FN from the two-class classification problem to the corresponding places in the table for the four-class classification problem.

[0038] Based on the above confusion matrix, the model evaluation metrics used are:

[0039] (1) Accuracy: Accuracy refers to the percentage of successfully classified samples out of the total number of samples in the output of the classification model.

[0040]

[0041] (2) Precision: Precision refers to the percentage of samples that are successfully classified as true out of all samples in the output results.

[0042]

[0043] (3) Recall: Recall refers to the percentage of samples that are successfully classified out of all samples whose labels are true in the real situation.

[0044]

[0045] Based on the above criteria, we applied this model to ECG signal diagnosis and recognition and presented the results. Figures 1 to 8 ,in Figures 1-6 The effects of the first three models are as follows, and Figures 7-8 The final experimental results of the composite random forest that integrates the first three models are presented.

[0046] Experimental results:

[0047] This invention achieves the identification and diagnosis of electrocardiogram (ECG) signals by combining an improved composite machine learning model with a random forest background algorithm. The decision tree in the traditional random forest algorithm is improved by adding a backpropagation (BP) neural network and a support vector machine (SVM) beneath the random forest, enhancing both the model's interpretability and accuracy. Experimental results show that the improved composite machine learning model achieves a minimum accuracy of 98.3%. In summary, this invention effectively realizes the identification and diagnosis of ECG signals.

[0048] Figure and Table Description

[0049] Figure 1 It is a decision tree classification confusion matrix

[0050] Figure 2 It is a decision tree classification evaluation indicator.

[0051] Figure 3 It is the BP neural network classification confusion matrix

[0052] Figure 4 It is a BP neural network classification evaluation index

[0053] Figure 5 It is the SVM (Support Vector Machine) classification confusion matrix.

[0054] Figure 6 It is an evaluation metric for SVM (Support Vector Machine) classification.

[0055] Figure 7 It is a composite random forest classification confusion matrix

[0056] Figure 8 It is a composite random forest classification evaluation index

[0057] Figure 9 The image shows the effect of wavelet denoising on the electrocardiogram signal waveform before and after the denoising.

[0058] Figure 10 This is a flowchart illustrating the implementation process of this patent (analyzed in conjunction with the abstract and accompanying drawings). Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0060] A method for electrocardiogram (ECG) signal recognition and diagnosis based on composite machine learning includes the following steps:

[0061] S1: Download data. Search and download the MIT-BIH arrhythmia database to prepare for training the composite machine learning system using the classification results and datasets provided therein.

[0062] S2: Read the electrocardiogram signal and obtain the horizontal and vertical coordinates of each detection point through the .dat file; obtain the manual annotation type of each heartbeat through the .atr file.

[0063] S3: Further preprocess the data by using MATLAB software to perform wavelet denoising on the ECG signal, and then dividing it into units based on individual heartbeats. This method can address the problem of ECG signal distortion and preserve accurate features for subsequent identification of ECG abnormality types.

[0064] S4: ECG signal feature extraction. After accurately segmenting each heartbeat, corresponding features can be extracted for each heartbeat. Here, the interval length of each heartbeat is X1, the R-wave peak height is X2, the length of a single R-wave range is X3, and the steepness of the R-wave (slope) is X4.

[0065] S5: Construct a decision tree model. Choose any three features from the four categories mentioned above to form a decision tree. The decision tree will learn a classifier. This classifier classifies based on the given features and can correctly classify a given sample.

[0066] S6: A backpropagation (BP) neural network that takes the above four features as input and outputs the ECG abnormality type for each heartbeat. This set of data is considered a single sample. This process is repeated to extract 8160 heartbeats as 8160 samples for training. Of these, 70% are selected as training samples and 30% as test samples.

[0067] S7: Support Vector Machine (SVM) maps the original features X1X2X3X4 using a kernel function to establish a new high-dimensional space. The soft boundary is then used as the loss function. By continuously calculating the loss function, the optimal three-dimensional space is found to achieve binary classification. This process is repeated to build SVMs for each of the remaining classes. When classifying test samples, the sample is finally assigned to the class with the largest percentage of samples.

[0068] S8: A composite random forest that treats the BP neural network and support vector machine as ordinary decision trees in a traditional random forest, together with the decision trees in S5, as "decision trees" in a new random forest, and jointly votes to determine the type of each heartbeat.

[0069] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for electrocardiogram (ECG) signal recognition and diagnosis based on composite machine learning, characterized in that, Includes the following steps: S1: Wavelet transform preprocessing is performed on MIT-BIH data to eliminate noise, and feature extraction is performed on the noise-processed ECG signal; four types of features are obtained: the interval length of each heartbeat is X1, the R wave peak height is X2, the range length of a single R wave is X3, and the steepness of the R wave, i.e., the slope, is X4. S2: Construct a decision tree model. Any three of the four types of features mentioned above can be selected to form a decision tree. The decision tree will learn a classifier. This classifier is based on the given features and can give the correct classification for a given sample. S3: Input the four features from S1 into the BP neural network and output the ECG abnormality type of each heartbeat. After passing through the hidden layer and backpropagation, output the heartbeat type as the result. The four features of each heartbeat combined with its ECG abnormality type will be used as a sample. In this way, the features and types of 8160 heartbeats are extracted as 8160 samples. Among them, 70% are selected as training samples and 30% are test samples. S4: In order to overcome the problem that traditional support vector machines can only perform binary classification, a one-to-one approach is adopted to build 6 support vector machines for 4 types of heartbeats. Each support vector machine is used to classify two types of heartbeats. Finally, the classification results of these 6 support vector machines are voted on and the heartbeat type with the most votes is taken as the result output. S5: Improved Random Forest Model: The above three algorithms are collectively classified under Random Forest and used as "decision trees" to vote on the results of the same sample to obtain the best sample classification result.

2. The ECG signal recognition and diagnosis method based on composite machine learning according to claim 1, characterized in that: The wavelet transform in step S1 can greatly reduce noise and interference, making the filtered ECG signal smoother, providing interference-free data for subsequent feature extraction, and improving the accuracy of model training.

3. The ECG signal recognition and diagnosis method based on composite machine learning according to claim 1, characterized in that: The decision tree in step S2 has good interpretability by nature; on the one hand, the tree structure is relatively easy to understand and does not require expert interpretation; on the other hand, the decision tree can be easily transformed into an applicable module with strong applicability; combining multiple decision trees with random forest improves the accuracy of model classification.

4. The ECG signal recognition and diagnosis method based on composite machine learning according to claim 1, characterized in that: The BP neural network in step S3 has good performance in multidimensional data processing and has strong learning and parallel computing capabilities for four-dimensional data of electrocardiogram signals. Since neural network algorithms have natural self-learning and adaptive capabilities, they can make up for the shortcomings of other machine learning methods in terms of low efficiency. During training, the BP neural network can automatically extract the "reasonable rules" between output and output data by learning, and adaptively memorize the learned content into the weights of the network.

5. The ECG signal recognition and diagnosis method based on composite machine learning according to claim 1, characterized in that: The Support Vector Machine (SVM) model transforms the classification task from a linearly inseparable low-dimensional space to a linearly separable high-dimensional space through a nonlinear kernel function. Then, it uses algorithmic analysis to find the optimal hyperplane and finally returns to the original space to obtain the solution in the initial space. It extends the limitation of traditional binary classification of SVM to a four-class classification problem, and performs classification voting on the results obtained by each class, achieving good results.

6. A method for ECG signal recognition and diagnosis based on composite machine learning according to any one of claims 1-5, characterized in that: The improved random forest model in step S5 has two advantages: firstly, its strong randomness enhances its noise resistance and makes it less sensitive to outliers; secondly, its tree-like structure provides high interpretability.

Citation Information

Patent Citations

  • Machine learning based human disease detection methods and detection product

    CN110090012A

  • Turnout fault diagnosis method based on random forest

    CN111046931A