A classification method based on shapelet to convert ECG signals into graph structures
By converting ECG signals into graph structures and using graph convolutional neural networks for classification, the interpretability and accuracy issues of abnormal ECG signal events are solved, and efficient and accurate ECG signal recognition is achieved.
Patent Information
- Application Number
- CN202211438097.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-11-16
AI Technical Summary
The existing technology lacks interpretability and accuracy in the classification of abnormal events in electrocardiographic signals. Traditional methods are inefficient and have poor real-time performance, and deep learning models lack interpretability.
The time series shapelet algorithm is used to convert ECG signals into a graph structure. The shapelet transformation matrix is constructed using the shapelet feature sequence. The ECG signal is classified by combining the graph convolutional neural network (GCN). The feature sequence is extracted by wavelet transform denoising and R-wave peak location.
It improves the efficiency and accuracy of ECG signal recognition, provides directly interpretable classification results, and quickly identifies cardiovascular diseases.
Smart Images

Figure CN115718867B_ABST
Abstract
Description
Technical Field
[0001] The present invention provides a classification method for converting electrocardiogram signals into graph structures based on shapelet, belonging to the technical field of heartbeat information analysis. Background Art
[0002] Because ECGs are susceptible to various interference signals when monitoring human health, clinicians often rely on common sense to subjectively ignore severely interfered ECG waveforms before making judgments. This manual ECG recognition method is not only inefficient and lacks real-time performance, but also prone to misdiagnosis.
[0003] Traditional analysis methods often classify ECG signals by extracting features. In recent years, with the rise of technologies such as deep neural networks and artificial intelligence, research on ECG signal classification using deep learning methods has increased. However, both traditional analysis methods and machine learning classification methods only classify ECG signals—that is, identify whether they are normal or abnormal. Existing technologies lack solutions for classifying abnormal events within ECG signals. With the continuous advancement of time series research, data mining, deep learning, and machine learning techniques are widely used in fields such as finance, healthcare, and biology. Their goal is to extract features from different sequences. ECG data is also a form of time series data, and the time series shapelet algorithm can be effective in processing problems in this field. Time series modeling aims to discover temporal relationships in chronologically arranged data. The key issue here is how to extract representative features of the time series. Previous frameworks have largely ranged from classic feature engineering and representation learning to deep learning-based models. Most deep learning models are learned end-to-end. While these methods have achieved good performance, they have also been criticized for their lack of interpretability. On the other hand, time series shapelets are time series subsequences representing a class, which can provide directly interpretable and explainable insights in classification scenarios.
[0004] Abnormal events in ECG signals are crucial for ECG signal analysis. These include myocardial infarction, heart failure, arrhythmia, bundle branch block, posterior myocardial infarction, and more. However, existing methods for classifying abnormal events in ECG signals lack interpretability and accuracy. The time series shapelet algorithm employed in this paper can effectively extract features from ECG signals and classify the dataset using the deep learning model GCN, resulting in more accurate results. Summary of the Invention
[0005] In response to the problems existing in the above-mentioned prior art, the present invention provides a classification method based on shapelet that converts ECG signals into graph structures, which can effectively identify ECG signals. This method saves time and effort, can effectively analyze ECG data, and improve recognition efficiency and accuracy.
[0006] To achieve the above technical objectives, the present invention provides a classification method for converting ECG signals into graph structures based on shapelets, characterized by: converting different ECG data signals into shapelet feature sequences using a time series shapelet algorithm, constructing a shapelet transformation matrix using the shapelet feature sequences, and using the shapelet transformation matrix to capture the evolution of shapelets over time to reflect the changes in ECG signal features over time;
[0007] The specific steps are as follows:
[0008] S1: Obtain multiple sets of ECG data signals representing different cardiac characteristics from the diagnostic ECG database, and combine the multiple sets of ECG data signals into an ECG dataset T = {t1,····,t |T|};
[0009] S2: preprocessing the acquired ECG data set, and performing noise reduction processing on each group of ECG data signals in the ECG data set using a wavelet transform denoising algorithm;
[0010] S3: Each denoised ECG dataset is processed using the wavelet modulus maximum combined with the variable threshold method: the denoised ECG dataset is first transformed using the Mallat algorithm, and then the zero point of the ECG dataset is located to locate the R wave peak in the time domain of the ECG dataset;
[0011] S4: Using the location information of the R wave peak and the period information of the electrocardiogram, the corresponding electrocardiogram dataset is divided into multiple subsequences, and the feature sequence of each divided electrocardiogram signal subsequence is extracted by the time series shapelet algorithm, and the extracted feature sequence is defined as the shapelet feature sequence;
[0012] S5: The extracted shapelet feature sequence is used to construct a shapelet transformation matrix of a graph structure, that is, a directed weighted graph G, and multiple shapelet transformation matrices are generated according to the electrocardiogram signals of various different heart states: the shapelet transformation matrix is used to learn the representation of the electrocardiogram signal sequence, the shapelet feature sequence is used as each node of the graph structure, and the weight relationship between each shapelet feature sequence is used to determine the weight between each node and then construct a directed weighted graph G = (V, E), where V represents each vertex in the directed weighted graph G, V consists of K vertices, each vertex represents a shapelet feature sequence, and the node constructed by this sequence, each directed edge e of the directed weighted graph G ij ∈E are all associated with a weight w ij associated;
[0013] S6: Set the conventional model parameters of the graph convolutional neural network GCN, divide the directed weighted graph G data set corresponding to the shapelet transformation matrix into a 70% training set and a 30% test set, and input the data into the graph convolutional neural network model GCN. After setting the parameters of the GCN model, perform training. After the convolution operation of the graph convolutional neural network model GCN, the probability of each ECG signal sample with different characteristics is obtained through the Softmax function. The GCN model is used to process the ECG signal into a directed weighted graph G. Each node in the directed weighted graph G corresponds to a shapelet feature sequence, representing a feature sequence of the ECG signal of a heart disease. After model training, a vector value of each node can be obtained, that is, the disease of each heart state, and then the probability of each vector is obtained through the softmax function to achieve the purpose of classification, and the predicted probability of the output category is normalized to identify the ECG signals of patients with different cardiovascular diseases.
[0014] Furthermore, it is characterized in that the specific steps of using the wavelet transform denoising algorithm to perform noise reduction processing on the electrocardiogram data signal are:
[0015] S2.1. Selecting coif4 in the Coifiet wavelet system as the wavelet basis function in wavelet denoising is the most ideal tool for time domain and frequency domain analysis of ECG signals.
[0016] S2.2, using formula (1) to determine the number of wavelet decomposition layers j in the denoising process according to the sampling frequency and noise frequency of the electrocardiogram;
[0017]
[0018] Where, f s is the sampling frequency, f noise= infmin{fnoise1,fnoise2......fnoisen} is the ECG signal selected from the database, and the lowest frequency among all noises is the lower limit frequency, where f noise 1,f noise2 ......f noisen is the frequency band of N different noise types contained in the ECG signal, [x] represents rounding down;
[0019] S2.3, using discrete wavelet transform to denoise the ECG signal according to formula (2);
[0020]
[0021] Where, jk (t) is the discrete wavelet basis; is Ψ jk (t) complex conjugate; WT f (j,k) are discrete wavelet transform coefficients.
[0022] Furthermore, the weight of the directed weighted graph is calculated using formula (3);
[0023]
[0024] Where, is the Euclidean distance or other distances based on different time series representation and state identification methods, X t To divide the ECG signal subsequence, Θ v To extract the shapelet feature sequence of the ECG signal, the shapelet feature sequence extracted in S4 is used as each node of a directed weighted graph. The Euclidean distance or DTW distance between each different shapelet feature sequence and the assigned different ECG signal subsequences is calculated according to the weight formula (3) to construct the edges of the graph structure. Finally, the extracted different shapelet feature sequences are converted into a directed weighted graph structure.
[0025] Furthermore, extracting the ECG signal shapelet feature sequence specifically includes:
[0026] S4.1. To ensure the authenticity of different heartbeat sample data, multiple sampling points are set for each heartbeat, among which the central electrical signal set T = {t1,····, t|T|}, where each ECG signal t contains n elements arranged in time order, i.e. t={x1,····,x n}, the segment s of the ECG signal t is a continuous subsequence, that is, s={x i ,····,x j}, the ECG signal t is divided into m equal-length I segments, and the characteristic segments of different heart diseases are set as shapelet v feature sequences;
[0027] S4.2. Selecting candidate shapelet segments. In order to select candidate shapelet segments from the candidate pool ECG signal sequence, a greedy algorithm strategy is used to select candidate shapelet segments from all possible subsequences. The equivalence distance between the selected shapelets is maximized to satisfy the search space.
[0028] S4.3, the ECG signal sequence t is divided into m segments, i.e., t = {s1,···,s m}; According to the formula: where t represents the Euclidean distance between the shapelet v feature sequence and the ECG signal sequence t. The local parameter w and global parameter u associated with each candidate shapelet segment are set. These two parameters can reflect the importance of the ECG signal at different times and can also be learned separately under some appropriate criteria. When a simple classification task is set, a supervised learning method is used to select the most important shapelet feature sequence and learn the corresponding hyperparameter w for the set shapelet v feature sequence. i and u i ;
[0029] S4.4, shapelet v feature sequence can divide the ECG signal T into two or more smaller sets, some close to v, and others far away from v according to the standard. In this way, for the time series classification task, different ECG information samples are placed in different groups. At this time, the standard loss is: Measure the difference between the candidate sample and the shapelet v feature sequence; where S * (v,T) represents the value relative to a specific group T * distance set, that is, positive or negative class; where λ and ∈ are hyperparameters, the differentiable function g takes two or more finite sets as input and returns a scalar value to indicate the distance between the two sets. After learning the time factor from the shapelet candidates, the top K sequence shapelets with the smallest loss in the equation are selected, which is the shapelet feature sequence to be extracted.
[0030] Furthermore, the specific steps of step S5 are as follows:
[0031] S5.1. First, each segment s of each ECG signal sequence is divided into i Assigned to several iThe nearest shapelet feature sequences are predefined with a threshold δ, so that the distance less than δ is considered close. In the experiment, δ is determined by experimental statistics of the training data set; the segments assigned to s i The shapelet feature sequences are represented as v i,* , expressed as: v ij It is segment s i The jth allocation of
[0032] In order to measure the rationality of the distribution, the distribution probability, i.e., the weight p i,j Normalized to:
[0033]
[0034] in is the Euclidean distance or other distances based on different time series representation and state identification methods, and is therefore assigned to segment s i The shapelet feature sequence set v i,* With probability p i,* Assigned to segment s i , and assigned to segment s i+1 The shapelets feature sequence set vi +1,* With probability p i+1,* Assigned to segment s i+1 , paragraph s i The last segment s i+1 Column; for each pair of nodes (j, k), create a weighted edge between the nodes, the weight is based on the formula: p i,j *p i+1 ,k; merge all duplicate edges into one by summing up their weights; normalize the edge weights from each node to 1, which naturally balances the edge weights between each pair of nodes;
[0035] S5.2, ECG signal set T = {t1,···,t |T|}The adjacent segments of the central electrical signal t (s i ,s i+1 ) and the assigned shapelet feature sequence set (v i,j ,v i+1 ,k), by adding weight pi ,j *p i+1 ,k directed edge ej,k, normalize the edge weight of each vertex, and then extract the K shapelets {v1···v K}The feature sequence is combined with it to finally obtain a directed weighted graph.
[0036] Furthermore, the graph convolutional neural network required in step S7 is a two-layer graph convolutional neural network GCN, including activation functions using linear rectification function ReLU and softmax function, learning rate lr = 0.001, using Adam optimizer, and cross entropy loss function; the graph convolutional neural network GCN model is used to train the shapelet directed weighted graph composed of the electrocardiogram signals of the original database after feature extraction and transformation, and then the probability of each sample is obtained by the Softmax function after the convolution operation, and the predicted probability of the output category is normalized to identify the electrocardiogram signals of patients with cardiovascular diseases, thereby achieving the purpose of identifying various cardiovascular diseases.
[0037] Beneficial effects:
[0038] This method saves time and effort, can effectively analyze ECG data, improve recognition efficiency and accuracy, and uses shapelets to represent a time series subsequence of a category. Compared with the existing solutions that lack interpretability, this method can provide directly interpretable and explanatory insights in classification scenarios. It can train all lead ECG signals quickly and has high recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a flow chart of the classification method of the present invention for converting electrocardiogram signals into graph structures based on shapelet;
[0040] Figure 2 is a schematic diagram of a classification method for converting electrocardiogram signals into a graph structure based on shapelet in the present invention;
[0041] Figure 3 It is a schematic diagram of the graph convolutional neural model provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The technical solutions in the embodiments of the present invention are further described in detail below with reference to the accompanying drawings and specific examples.
[0043] like Figure 1 As shown, the present invention provides a classification method for converting electrocardiogram signals into a graph structure based on shapelet, comprising the following steps:
[0044] S1: Obtain multiple sets of ECG data signals representing different cardiac states from the diagnostic ECG database. Each set of ECG data sets is represented by T = {t1,····,t |T|};
[0045] S2: Preprocess the acquired ECG data set and use the wavelet transform denoising algorithm to perform noise reduction on multiple sets of ECG data signals;
[0046] S3: Use wavelet modulus maximum combined with variable threshold method to process each group of ECG data signals after noise reduction: first use Mallat algorithm to transform the ECG data signal after noise reduction, and then locate the zero point of the ECG signal to locate the R wave peak of the ECG signal in the time domain space.
[0047] S4: Using the positioning information of the R wave peak and the period information of the ECG, the shapelet algorithm is used to extract the shapelet feature sequence of the P-QRS-T band of each signal cycle. The extracted ECG signal shapelet features are constructed as each node of the graph structure, and the ECG signal is divided into multiple subsequences. The feature sequence of each divided subsequence is extracted by the shapelet algorithm and is called the shapelet feature sequence.
[0048] S5: Construct the shapelet transformation matrix (graph) from the extracted shapelet feature sequence: Use the shapelet transformation matrix to learn the representation of the ECG signal sequence. The shapelet feature sequence is used as each node of the graph structure, and the weight between each node is determined according to the weight relationship between each feature point to construct a directed weighted graph G = (V, E), where V consists of K vertices, each vertex represents a shapelet feature sequence, and each directed edge e ij ∈E are all associated with a weight w ij Associated, where each shapelet transformation matrix corresponds to the electrocardiogram signals of multiple different heart states.
[0049] S6: Determine the general model parameters of the graph convolutional neural network (GCN), divide the directed weighted graph structure corresponding to the shapelet transformation matrix into a 70% training set and a 30% test set, and input them into the graph convolutional neural network model GCN. After setting the model parameters, conduct training. After the convolution operation of the graph convolutional neural network model GCN and then the Softmax function, the probability of each ECG signal sample with different characteristics is obtained.
[0050] Example 1, as Figure 2 As shown:
[0051] Step S1: Obtain two-lead electrocardiogram data signals from the MIT-BIH database. These data signals cover five types of subjects: myocardial infarction, heart failure, arrhythmia, bundle branch block, and healthy controls. Myocardial infarction, heart failure, arrhythmia, and bundle branch block are collectively classified as cardiovascular diseases. The database contains more than 4,000 long-term dynamic electrocardiogram (DECT) records, 60% of which are from inpatients and 40% from outpatients. The subjects are 25 men aged between 32 and 89 years old and 22 women aged between 23 and 89 years old. It contains 48 half-hour two-channel dynamic electrocardiogram records, which are digitized at 11-bit resolution within a 10mV range at a sampling frequency of 360 samples per second per channel. Two cardiologists annotated each record (approximately 110,000 annotations in total). These data signals cover five types of subjects: myocardial infarction, heart failure, arrhythmia, bundle branch block and healthy control group. Among them, myocardial infarction, heart failure, arrhythmia and bundle branch block are collectively classified as cardiovascular diseases.
[0052] Step S2: Because the time-frequency localization characteristics of wavelet transform can effectively filter out the noise overlapping with the ECG signal, the wavelet transform denoising algorithm is used to reduce the noise of the signal obtained in step 1:
[0053] x[n]=f(n)+w(n);
[0054] Where n is time, x[n] is the noisy signal, f(n) is the useful signal, and w(n) is the Gaussian white noise signal. After the useful signal f(n) undergoes wavelet transform, the energy of the mutation point is concentrated on the wavelet coefficients of the larger scale, while the wavelet coefficients of the noise signal after wavelet transform are not correlated. The wavelet at the scale where the noise signal is concentrated is processed and then reconstructed, thus completing the wavelet transform process. For example, Gaussian white noise remains Gaussian white noise after wavelet transform, and its wavelet coefficients are not correlated. The wavelet coefficients obtained after wavelet transform of Gaussian white noise are distributed at various scales, and the amplitude of each part is not large. Therefore, they can be separated by first performing wavelet transform and then processing and reconstructing the wavelet coefficients. The same applies to other noise.
[0055] Step S3: Processing the ECG signal de-noised in step S2 using the wavelet modulus maximum combined with the variable threshold method; first, transforming the ECG signal using the Mallat algorithm, and locating the zero point of the ECG signal to locate the peak of the R wave in the time domain;
[0056] Step S4: Extracting the ECG signal shapelet feature sequence, specifically including:
[0057] S41: ECG signals from the MIT-BIH database were selected. In the experiment, 10s of ECG signals were selected for each subject. Due to the different heart rates of the subjects, the number of heartbeats of the patients in 10 seconds ranged from 8 to 17. Therefore, the number of selected heartbeat sampling points varied from subject to subject. In order to ensure the authenticity of the data, the subject with a heartbeat of 8 times / 10s was used as the standard. A total of 600 sampling points were set for each heartbeat, where each ECG signal set T = {t1,····,t |T|}, where each ECG signal t contains n elements arranged in time order, i.e. t={x1,····,x n The segment s of the ECG signal t is a continuous subsequence, that is, s={x i ,····,x j}, the ECG signal t is divided into m equal-length I segments, and the characteristic segments of different heart diseases are set as shapelet v feature sequences.
[0058] S42: Selecting candidate shapelet segments. In order to select candidate shapelet segments from all ECG signal sequences in the candidate pool, we applied a greedy algorithm strategy to select candidate shapelet segments from all possible subsequences. The key idea is to maximize the equivalence distance between the selected shapelets to satisfy the search space.
[0059] S43: The ECG signal sequence t is divided into m segments, i.e., t={s1,···,s m According to the formula:
[0060]
[0061] where represents the Euclidean distance between the shapelet feature sequence v and the ECG signal sequence t. Set the local parameter w and global parameter u associated with each candidate shapelet segment. These two parameters can reflect the importance of the ECG signal at different times and can also be learned separately under some appropriate criteria. For example, a simple classification task can be set, and a supervised learning method can be used to select the most important shapelet feature sequence, and the corresponding hyperparameter w can be learned for the given shapelet feature sequence v. i and u i .
[0062] S44: A shapelet feature sequence v is a characteristic segment representing different heart diseases. More precisely, it can divide the ECG signal set T into two or more smaller sets, some close to v and others far from v based on certain criteria. This allows different samples to be placed into different groups when applied to different ECG signal classification tasks. We have a pool of candidate segments as shapelet feature sequences generated by the algorithm, as well as a set of labeled ECG signal dataset sequences T. For each shapelet feature sequence candidate segment, the criterion can be formalized as:
[0063]
[0064] It represents the difference between the candidate segments in the candidate pool and the shapelet v feature sequence. * (v,T) represents the value relative to a specific group T * The distance set, that is, the positive class or the negative class; where λ and ∈ are hyperparameters, the differentiable function g takes two or more finite sets as input and returns a scalar value to indicate the distance between the two sets, which can be information gain or divergence. In the example, the given set generally conforms to a specific distribution, such as the Gaussian distribution. We can easily estimate the distribution parameters through closed-form solutions. The gradient of g can then be derived from these differentiable parameters. After learning the time factor from the candidate fragment, we select the top K shapelets with the smallest loss in the equation, which is the shapelet feature sequence we need to extract.
[0065] Step S5: Construct a shapelet transformation matrix, construct a shapelet transformation matrix (directed weighted graph G) for the shapelet feature sequence extracted in step S4, and construct a directed weighted graph G = (V, E), where V consists of K vertices, each vertex represents a shapelet feature sequence, and each directed edge e ij ∈E are all associated with a weight w ij associated.
[0066] S51: First, each segment s of each ECG signal sequence is divided into i Assigned to several i The closest shapelet feature sequences are predefined with a threshold δ, so that distances less than δ are considered close. In the experiment, we can determine δ by experimental statistics of the training data set. For convenience, we will assign segment s i The shapelet feature sequences are represented as v i,* , and say v ij It is segment s i No. jTo measure the rationality of our allocation, we normalize the allocation probability pi,j (weight) as:
[0067]
[0068] It can also be expressed as:
[0069]
[0070] where ^di,*(v i ,*,s i )or is the Euclidean distance or other distances based on different time series representation and state identification methods, and is therefore assigned to segment s i The shapelets feature sequence set v i,* With probability p i,* Assigned to segment s i , and assigned to segment s i+1 The shapelets feature sequence set v i+1,* With probability p i+1,* Assigned to segment s i+1 , paragraph s i The last segment s i+1 Then, for each pair of nodes (j, k), we create a weighted edge between the nodes, and the weight is p according to the above weight formula i,j *p i+1 ,k, and merge all duplicate edges into one by summing up their weights. Finally, we normalize the edge weights from each node to 1, which naturally balances the edge weights between each pair of nodes.
[0071] S52: ECG signal sequence set T = {t1,···,t |T|}The adjacent segments of the central electrical signal t (s i ,s i+1 ) and the assigned shapelet feature sequence set (v i,j ,v i+1 ,k), by adding weight p i,j *p i+1 ,k's directed edge e j,k , normalize the edge weight of each vertex, and then extract the K shapelets {v1···v K}The feature sequence is combined with it to finally obtain a directed weighted graph.
[0072] Step S6: We use the shapelet transformation matrix (graph) constructed above to learn the representation of the shapelet and the given ECG signal sequence. We first use the existing graph embedding algorithm to obtain the vertex representation vector μ. Then, by feeding the embedded features into the neural network model, the representation vector of the ECG signal sequence can be used as a feature for various classification tasks. Here, we construct a two-layer GCN, with the activation function using the rectified linear unit (ReLU) and the softmax function, the learning rate lr = 0.001, the Adam optimizer, and the cross-entropy loss function. In order to alleviate the overfitting phenomenon, the dropout technology is introduced, that is, some neurons in the convolutional neural network are randomly discarded according to a certain proportion. Such a graph convolutional neural network model is constructed to learn the shapelet directed weighted graph composed of the original ECG signal after feature extraction and transformation. After the convolution operation, the probability of each sample is obtained by the softmax function, and the predicted probability of the output category is normalized. The ECG signals of patients with cardiovascular diseases are identified, thereby achieving the purpose of identifying various cardiovascular diseases.
[0073] After learning from a large amount of input graph data, the graph convolutional neural network continuously updates the model parameters by feeding back feature parameters layer by layer from back to front. This enables the graph convolutional neural network model to achieve faster and more accurate detection results when identifying and classifying ECG signals after training. The experiment obtained 258 sets of preprocessed ECG signal data, 75% of which were used for training, and the remaining samples were used for testing.
[0074] The test was conducted on a Windows system using an NVIDIA GeForce GTX3060Ti. The Adam optimizer and binary cross-entropy loss function were used. Furthermore, in batch training, the batch size was set to 8 and the epoch was set to 50. The percentile of the distance threshold δ was set to 10, and the hyperparameters λ and ∈ were fixed at 0.5 and 0.1, respectively. When the GCN model was trained on all ECG leads during the 50-epoch period, the test set accuracy reached 90% after 20 iterations. The graph convolutional neural network model essentially converged after 50 iterations, and the resulting one-dimensional convolutional neural network model achieved a recognition accuracy of 98.39% on the test data.
Claims
1. A classification method for converting electrocardiogram signals into graph structures based on shapelet, characterized by: Different ECG data signals are converted into shapelet feature sequences through the time series shapelet algorithm. The shapelet feature sequence is used to construct a shapelet transformation matrix. The shapelet transformation matrix is used to capture the evolution of shapelets over time to reflect the changes in ECG signal characteristics over time. The specific steps are as follows: S1: Obtain multiple sets of ECG data signals representing different cardiac characteristics from the diagnostic ECG database, and combine the multiple sets of ECG data signals into an ECG dataset T = {t1,····,t |T| }; S2: preprocessing the acquired ECG data set, and performing noise reduction processing on each group of ECG data signals in the ECG data set using a wavelet transform denoising algorithm; S3: Each denoised ECG dataset is processed using the wavelet modulus maximum combined with the variable threshold method: the denoised ECG dataset is first transformed using the Mallat algorithm, and then the zero point of the ECG dataset is located to locate the R wave peak in the time domain of the ECG dataset; S4: Using the location information of the R wave peak and the period information of the electrocardiogram, the corresponding electrocardiogram dataset is divided into multiple subsequences, and the feature sequence of each divided electrocardiogram signal subsequence is extracted by the time series shapelet algorithm, and the extracted feature sequence is defined as the shapelet feature sequence; S5: The extracted shapelet feature sequence is used to construct a shapelet transformation matrix of a graph structure, that is, a directed weighted graph G, and multiple shapelet transformation matrices are generated according to the electrocardiogram signals of various different heart states: the shapelet transformation matrix is used to learn the representation of the electrocardiogram signal sequence, the shapelet feature sequence is used as each node of the graph structure, and the weight relationship between each shapelet feature sequence is used to determine the weight between each node and then construct a directed weighted graph G = (V, E), where V represents each vertex in the directed weighted graph G, V consists of K vertices, each vertex represents a shapelet feature sequence, and the node constructed by this sequence, each directed edge e of the directed weighted graph G ij ∈E are all associated with a weight w ij associated; S6: Set the conventional model parameters of the graph convolutional neural network GCN, divide the directed weighted graph G data set corresponding to the shapelet transformation matrix into a 70% training set and a 30% test set, and input the data into the graph convolutional neural network model GCN. After setting the parameters of the GCN model, perform training. After the convolution operation of the graph convolutional neural network model GCN, the probability of each ECG signal sample with different characteristics is obtained through the Softmax function. The GCN model is used to process the ECG signal into a directed weighted graph G. Each node in the directed weighted graph G corresponds to a shapelet feature sequence, representing a feature sequence of the ECG signal of a heart disease. After model training, a vector value of each node can be obtained, that is, the disease of each heart state, and then the probability of each vector is obtained through the softmax function to achieve the purpose of classification, and the predicted probability of the output category is normalized to identify the ECG signals of patients with different cardiovascular diseases.
2. The classification method for converting electrocardiogram signals into graph structures based on time series shapelet according to claim 1, characterized in that: The specific steps of using the wavelet transform denoising algorithm to reduce the noise of the electrocardiogram data signal are as follows: S2.
1. Selecting coif4 in the Coifiet wavelet system as the wavelet basis function in wavelet denoising is the most ideal tool for time domain and frequency domain analysis of ECG signals. S2.2, using formula (1) to determine the number of wavelet decomposition layers j in the denoising process according to the sampling frequency and noise frequency of the electrocardiogram; Where, f s is the sampling frequency, f noise = infmin{fnoise1,fnoise2......fnoisen} is the ECG signal selected from the database, and the lowest frequency among all noises is the lower limit frequency, where f noise 1,f noise2 ......f noisen is the frequency band of N different noise types contained in the ECG signal, [x] represents rounding down; S2.3, using discrete wavelet transform to denoise the ECG signal according to formula (2); Where, jk (t) is the discrete wavelet basis; is Ψ jk (t) complex conjugate; WT f (j,k) are discrete wavelet transform coefficients.
3. The classification method for converting electrocardiogram signals into graph structures based on shapelet according to claim 1, characterized in that: Use formula (3) to calculate the weight of the directed weighted graph; Where, is the Euclidean distance or other distances based on different time series representation and state identification methods, X t To divide the ECG signal subsequence, Θ v To extract the shapelet feature sequence of the ECG signal, the shapelet feature sequence extracted in S4 is used as each node of a directed weighted graph. The Euclidean distance or DTW distance between each different shapelet feature sequence and the assigned different ECG signal subsequences is calculated according to the weight formula (3) to construct the edges of the graph structure. Finally, the extracted different shapelet feature sequences are converted into a directed weighted graph structure.
4. The classification method for converting electrocardiogram signals into graph structures based on shapelet according to claim 3, characterized in that: Extracting the shapelet feature sequence of the ECG signal specifically includes: S4.
1. To ensure the authenticity of different heartbeat sample data, multiple sampling points are set for each heartbeat, among which the central electrical signal set T = {t1,····, t|T| }, where each ECG signal t contains n elements arranged in time order, i.e. t={x1,····,x n }, the segment s of the ECG signal t is a continuous subsequence, that is, s={x i ,····,x j }, the ECG signal t is divided into m equal-length I segments, and the characteristic segments of different heart diseases are set as shapelet v feature sequences; S4.
2. Selecting candidate shapelet segments. In order to select candidate shapelet segments from the candidate pool ECG signal sequence, a greedy algorithm strategy is used to select candidate shapelet segments from all possible subsequences. The equivalence distance between the selected shapelets is maximized to satisfy the search space. S4.3, the ECG signal sequence t is divided into m segments, i.e., t = {s1,···,s m }; According to the formula: where t represents the Euclidean distance between the shapelet v feature sequence and the ECG signal sequence t. The local parameter w and global parameter u associated with each candidate shapelet segment are set. These two parameters can reflect the importance of the ECG signal at different times and can also be learned separately under some appropriate criteria. When a simple classification task is set, a supervised learning method is used to select the most important shapelet feature sequence and learn the corresponding hyperparameter w for the set shapelet v feature sequence. i and u i ; S4.4, shapelet v feature sequence can divide the ECG signal T into two or more smaller sets, some close to v, and others far away from v according to the standard. In this way, for the time series classification task, different ECG information samples are placed in different groups. At this time, the standard loss is: Measure the difference between the candidate sample and the shapelet v feature sequence; where S * (v,T) represents the value relative to a specific group T * distance set, that is, positive or negative class; where λ and ∈ are hyperparameters, the differentiable function g takes two or more finite sets as input and returns a scalar value to indicate the distance between the two sets. After learning the time factor from the shapelet candidates, the top K sequence shapelets with the smallest loss in the equation are selected, which is the shapelet feature sequence to be extracted.
5. The classification method for converting electrocardiogram signals into graph structures based on shapelet according to claim 4, characterized in that: The specific steps of step S5 are as follows: S5.
1. First, each segment s of each ECG signal sequence is divided into i Assigned to several i The nearest shapelet feature sequences are predefined with a threshold δ, so that the distance less than δ is considered close. In the experiment, δ is determined by experimental statistics of the training data set; the segments assigned to s i The shapelet feature sequences are represented as v i,* , expressed as: v ij It is segment s i The jth allocation of In order to measure the rationality of the distribution, the distribution probability, i.e., the weight p i,j Normalized to: in is the Euclidean distance or other distances based on different time series representation and state identification methods, and is therefore assigned to segment s i The shapelet feature sequence set v i,* With probability p i,* Assigned to segment s i , and assigned to segment s i+1 The shapelets feature sequence set vi +1,* With probability p i+1,* Assigned to segment s i+1 , paragraph s i The last segment s i+1 Column; for each pair of nodes (j, k), create a weighted edge between the nodes, the weight is based on the above weight formula: p i,j *p i+1 ,k merges all duplicate edges into one by summing up their weights; normalizes the edge weights from each node to 1, which naturally balances the edge weights between each pair of nodes; S5.2, ECG signal set T = {t1,···,t |T| }The adjacent segments of the central electrical signal t (s i ,s i+1 ) and the assigned shapelet feature sequence set (v i,j ,v i+1 ,k), add the weight p through the weight formula in step S5.1 i,j *p i+1 ,k directed edge ej,k, normalize the edge weight of each vertex, and then extract the K shapelets {v1···v K }The feature sequence is combined with it to finally obtain a directed weighted graph.
6. The classification method for converting electrocardiogram signals into graph structures based on shapelet according to claim 1, characterized in that: The graph convolutional neural network required in step S7 is a two-layer graph convolutional neural network GCN, including activation functions using linear rectification function ReLU and softmax function, learning rate lr = 0.001, using Adam optimizer, and adopting cross entropy loss function; the graph convolutional neural network GCN model is used to train the shapelet directed weighted graph composed of the electrocardiogram signals of the original database after feature extraction and transformation, and then the probability of each sample is obtained by the Softmax function after the convolution operation, and the predicted probability of the output category is normalized to identify the electrocardiogram signals of patients with cardiovascular diseases, thereby achieving the purpose of identifying various cardiovascular diseases.