COMPUTERS AND BIOMEDICAL RESEARCH ARTICLE NO.
31, 59–69 (1998)
CO971462
Serial VCG/ECG Analysis Using Neural Networks M. Sunemark,* L. Edenbrandt,* H. Holst,* and L. So¨rnmo*,† *Department of Clinical Physiology and †Signal Processing Group, Department of Applied Electronics, Lund University, Lund, Sweden E-mail:
[email protected]
Received July 31, 1997
Serial ECG analysis is an important diagnostic tool in which two or more successive ECG recordings from the same patient are compared in order to find changes due to, e.g. myocardial infarction. The present study investigates a new approach to serial analysis which is based on artificial neural networks. Interrecording changes are sometimes falsely detected due to electrode misplacement or positional changes of the heart. In order to compensate for such problems, a new technique for VCG loop alignment was employed. A study population of 1000 patients with two recordings was used and manually scrutinized by three experienced ECG interpreters. Pathological changes indicating newly developed infarcts were found in 256 patients. Different combinations of VCG/ECG measurements served as input data to the neural network. The best performance of the neural network was obtained when ECG and VCG measurements were combined and the resulting sensitivity was 69% at a specificity of 90%. The use of only ECG or VCG measurements reduced the sensitivity to 63% and 60%, respectively. The results indicated that serial analysis based on neural networks did not improve significantly when VCG loop alignment was included. 1998 Academic Press
1. INTRODUCTION Serial analysis of electrocardiograms (ECG) relies on the comparison of two or more successive recordings from the same patient. This analysis allows the physician to obtain a more reliable ECG interpretation than can be obtained from a single recording. The interpreter takes advantage of the fact that even small interrecording differences can be of pathological origin. Variation in ECG morphology from one occasion to another is usually much smaller than the variation in morphology between different patients. Therefore, pathological changes in the ECG related to, e.g. myocardial infarction, can be found more easily by means of serial comparison. Computer-based ECG interpretation is nowadays widely used. The quality of such interpretation has been found to be almost as good as that of an experienced ECG reader with respect to a variety of diagnosis (1). Serial analysis appears to be particularly well-suited for computer processing due to the ease of retrieving 59 0010-4809/98 $25.00 Copyright 1998 by Academic Press All rights of reproduction in any form reserved.
60
SUNEMARK ET AL.
earlier recordings from an ECG database (2, 3). Computer-based serial analysis has, however, been found to be inferior to a human reader. One reason to this relation is that serial analysis is more difficult to handle by conventional rulebased interpretation programs (4). An artificial neural network is a powerful tool for computer-based decision making which learns by example (5). Such networks have been successfully applied in the field of computer-based ECG interpretation; see e.g. (6, 7). The training of a neural network requires that the number of input variables is sufficiently small in order not to match the network to the training set. It is important to find informative and robust variables that reflect any changes which may occur between successive ECGs. Measurements of amplitude and duration of the Q, R, and S waves can, of course, be selected as input variables to the neural network. It is obvious, however, that the inclusion of such scalar measurements from the 12 leads results in an input data vector of considerable size. An alternative approach is to use the vectorcardiogram (VCG) which constitutes a three lead configuration and therefore provides a reduced number of input variables (8, 9). Another advantage with the VCG approach is the potential use of methods which may compensate for changes in waveform morphology due to interrecording differences in, e.g. electrode placement and body position. It is well known that small differences in electrode placement can have a large influence on the QRS complex morphology, e.g. a small Q wave which is present in the first recording may vanish in the second. The so-called CAVIAR program (CAVIAR—comparative analysis of VCGs and their interpretation with autoreference to the patient) was developed with the purpose of overcoming such types of problem by aligning the two VCG loops prior to serial analysis (10, 11). In that method, loop alignment is performed by minimizing the mean quadratic distance between successive points in the orthogonal lead space with respect to certain geometric transformations. The minimization is implemented by means of an iterative search procedure. The purpose of this study was to evaluate the feasibility of artificial neural networks for serial comparison of VCG/ECG recordings. The study employs a new technique for VCG loop alignment in which the optimal parameter estimates of certain geometric transformations are obtained in a noniterative fashion. Measurement sets which are derived from the VCG and the ECG, as well as from combinations of ECG/VCG measurements, are investigated and their relative performance merits are compared. 2. MATERIALS AND METHODS Patient Population A database of resting ECGs recorded at the Department of Clinical Physiology, Lund University, was used in the present study. From a total of 27,000 patients with more than one ECG stored in the database, 1000 patients were selected for this study. The first and the last ECG recording of each patient were used for serial analysis. Pacemaker or technically deficient recordings were excluded.
SERIAL VCG/ECG ANALYSIS
61
Three experienced ECG interpreters classified each pair of ECGs with respect to the occurrence of a newly developed myocardial infarction; their consensus served as a gold standard for the method investigated in the present study. The interpreters did not have access to the patient records during classification. The resulting infarction group consisted of 256 patients and the control group included the remaining 744 patients. Signal Acquisition The standard 12-lead ECGs were acquired during 10 sec by resting ECG carts (Siemens–Elema AB, Solna, Sweden). The leads were processed by the commercial software and a representative signal-averaged beat was obtained for database storage. A derived VCG signal was obtained by means of a linear combination of the standard 12-lead ECG; the resulting leads sX, sY, and sZ were computed from V1 2 V6 , I and II by using the ‘‘inverse’’ Dower matrix (12). The subsequent QRS complex and loop measurements were obtained from data sampled at a rate of 1000 Hz. VCG Loop Processing A new technique for VCG loop alignment was employed for compensating the effect of various extracardiac factors, e.g. respiration and changes in electrode placement (13). The two loops were aligned by allowing one of the loops, B, to be rotated, scaled, and synchronized in time in relation to the other loop A. The loop A was represented by a 3 3 150 matrix and B by an augmented matrix (3 3 170), where the extra samples were included to allow for time synchronization. In both matrices, the samples were selected in an interval which was centered around the QRS complex. The loop alignment was performed by means of leastsquares minimization with respect to the positive-valued scalar a, rotation by the orthonormal matrix Q, and the time synchronization parameter t of the displacement matrix Jt (this matrix is a unit matrix with its diagonal shifted t steps up or down). The optimal estimates of a, Q, and t were found by « 2min 5 min iA 2 aQBJt i 2F , a,t,Q
[1]
where the Frobenius norm for an m-by-n matrix X is given by iXi 2F 5 m n oi51 oj51 uxi j u2. The minimization in [1] was performed by first finding closed-form expressions for the estimates a and Q under the assumption that t is fixed. The optimal estimates of a, t, and Q were then determined by evaluating the error « 2 for different values of t in the interval [2D, D]. The estimate of Q is given by (13) ˆ t 5 UVT, Q
[2]
where the matrices U and V resulted from the singular value decomposition (14), C 5 USVT
[3]
62
SUNEMARK ET AL.
of the matrix C 5 AJTt BT; the diagonal matrix S contains the singular values. ˆ t in [2] since this estimate is only optimal for The index t has been attached to Q ˆ t available, one particular value of t. The estimate of a was then calculated with Q aˆ t 5
ˆ Tt A) tr(J Tt B TQ , T T tr(J t B BJt)
[4]
where tr denotes the trace of a matrix. The time synchronization parameter t was estimated by means of a grid search for the allowed set of values, ˆ tBJt i 2F . tˆ 5 arg min iA 2 aˆ tQ t
[5]
The estimate tˆ then determined which of the estimates in the set of estimates ˆ t that should be selected. Finally, the serial analysis was performed by aˆ t and Q comparison of the loop A to the compensated loop Bc , ˆ tˆBJtˆ . Bc 5 aˆ tQ
[6]
VCG/ECG Measurements Various measurement sets were investigated and selected in a pilot study using another database than that of the present study (15). Based on the results of the pilot study, the following 15 VCG measurements were selected and used in different combinations: ● The overall distance («min), the average and the maximum distance between the two QRS loops. ● The overall and the maximum distance of the first 20 msec of the loop in order to emphasize the properties of the initial QRS part. ● The three singular values determined from each of the loops A and Bc . These singular values provide ‘‘global’’ information about the loop morphology, e.g. its planarity and circularity. ● The estimates of the scaling factor a and the rotation matrix Q. The alternative representation of Q in terms of a series of planar rotations defined by three angles was used (13). It should be noted that the performance was studied both with and without these alignment parameters in the VCG measurement set. The following scalar ECG measurements were selected (21 from each recording): ● Q amplitudes in leads I, II, III, aVL, aVF, V2 2 V6 ● R amplitudes in leads I, II, III, aVL, aVF, V2 2 V6 ● QRS duration. Artificial Neural Network Artificial neural networks with a multilayer perceptron architecture were used in the present study (16); a general description of such neural networks can be found elsewhere (see, e.g., (5)). The neural networks consisted of one input, one
SERIAL VCG/ECG ANALYSIS
63
hidden, and one output layer. The number of neurons in the input layer was equal to the number of input variables. The number of neurons of the hidden layer ranged from three to six. A single neuron in the output layer encoded whether serial changes were present or not. During the training process, the connection weights between the neurons were adjusted using the backpropagation algorithm (16). The learning rate had a start value of h0 5 0.5. During the training, h was decreased geometrically every epoch i using a recursive relationship, i.e. hi11 5 ahi with a 5 0.998. The momentum was set to 0.7 and network updating occurred after every 50 patterns. The network weights were initiated with uniformly distributed random numbers between 20.025 and 0.025. All calculations were done using the JETNET 3.0 package (17). The output values of the network for test ECGs were in the range from 0 to 1. A threshold in this interval was used above which all values were regarded as consistent with serial changes in the ECG. By varying this threshold a receiver operating characteristics (ROC) curve was obtained. A tenfold cross validation procedure was used to get a reliable performance estimate. The total number of ECG pairs was randomly divided into 10 equal parts. One part was used in a test set while training was performed on the remaining nine parts. The procedure was repeated 10 times such that each part was used once as a test set. The performance of the neural networks was studied using separate test sets only. 3. RESULTS Serial analysis using neural networks was investigated for different combinations of VCG/ECG measurements in terms of ROCs. First, analysis based on VCG measurements only was studied when taken either directly from the two recordings or when loop alignment had been first performed. For the latter case of alignment, the neural network was trained using the alignment parameters for scaling and rotation angles as input as well as when these extra four parameters were excluded. The resulting three ROC’s are presented in Fig. 1. The analysis based on 11 VCG measurements did not improve when loop alignment was also incorporated; in fact, the performance deteriorated by such alignment. By including the alignment parameters as network input, the performance was improved and became essentially the same as that for the no-alignment case. Thus, the results indicated that the value of loop alignment is limited in relation to serial analysis, however, the examples presented below demonstrate the pros and cons with such a method. Next, serial analysis based on VCG measurements was compared to when either only ECG measurements were used or when the two types of measurements were combined (the corresponding number of network inputs were 11, 42, and 52, respectively). The best network performance was obtained for the combined VCG/ECG case and resulted in a sensitivity of 69% at a specificity of 90% (see Fig. 2). The networks fed with ECG measurements or VCG measurements had essentially the same performance figures and resulted in a sensitivity
64
SUNEMARK ET AL.
FIG. 1. Receiver operating characteristics for neural network based serial analysis using different input VCG measurement sets. The performance is presented for the VCG set without prior loop alignment (dash/dotted line), the VCG set using loop alignment but without inclusion of rotation angles in the set (lower solid line, ‘‘VCG-align1’’) and the VCG set with loop alignment and the inclusion of rotation angles (upper solid line, ‘‘VCG-align2’’).
of 63% and 60%, respectively, at the same specificity (90%). It is clear that the information content associated with VCG and ECG measurements, respectively, is essentially the same within the context of serial analysis. However, the present VCG based analysis is preferable due to the considerably lower number of measurements. The effects of VCG loop alignment on serial analysis are here examplified by recordings from two different subjects (see Fig. 3). In the first example, the VCG was classified by the interpreters as a pathological change indicative of myocardial infarction; the difference in loop configuration that the interpreters found be-
SERIAL VCG/ECG ANALYSIS
65
FIG. 2. Receiver operating characteristics for neural network based serial analysis using different input measurement sets. The performance is presented for the ECG/VCG set (dash/dotted line), the ECG set (solid line) and the VCG set (dashed line).
tween the ECGs are illustrated by the presentation in the top left panel of Fig. 3. The output of the neural network using VCG measurements and no loop alignment agreed with the decision of the interpreters. However, the two loops became very similar in configuration after alignment (see the top right panel of Fig. 3). As one may expect, the decision of the network was altered after alignment into ‘‘no serial change.’’ Since the discrepancy between human and network decision was substantial in this particular example, the patient record was checked for further details. It was found that the patient had had an additional ECG recorded the day after the second recording. This third loop was found to be very similar in morphology to the first one which thus strongly suggests that the patient did not have a myocardial infarction between the first and the second
66
SUNEMARK ET AL.
FIG. 3. Two examples which demonstrate the effects of VCG loop alignment. The top and bottom panels refer to two different subjects. The top panels show the effect of alignment when the loops are initially very dissimilar (A and B represent the first and the second recording, respectively). The bottom panels show the effect of loop scaling. Loop A and B1 represent the first and the second recording, respectively, and B2 is B1 after loop alignment. Loop alignment is performed without scaling (bottom left panel) and with scaling (bottom right panel). Note that the loops in all panels have been projected on the X-Y plane; see the text for further explanations.
SERIAL VCG/ECG ANALYSIS
67
recording. It is likely that these changes instead arose from extracardiac factors such as changes in heart position or electrode placement. It should be pointed out that classification based on the standard 12-lead ECG did not yield the correct decision for this example. Another example on VCG loop alignment is found in the two bottom panels of Fig. 3 and illustrates the effects of loop scaling by the parameter a. These two recordings were classified by the interpreters into the group of myocardial infarcts. This classification was later confirmed by the patient record in which it was stated that the patient had been admitted to the hospital for an acute infarct in connection with the second recording. The correct outcome was produced by the neural network when no loop alignment was performed or when alignment was performed without scaling (bottom left panel). However, the opposite result was obtained when scaling was incorporated into the alignment procedure (bottom right panel). The estimate of a was found to be large and was equal to 1.42. It is clear from this example that scaling, performed without any magnitude constraints, expanded the loop to such an extent that the wrong decision was made by the network. The network using ECG measurements only produced the correct serial decision in this example. 4. DISCUSSION The performance of computer-based ECG interpretation has earlier been tested for the diagnosis of myocardial infarction and hypertrophy using large databases of independently validated ECGs. The results of such studies showed that interpretation programs perform as good as human experts (1). Other aspects of automated interpretation, e.g. serial analysis, have not been validated in the same way. Databases with serial ECGs recorded on patients who have developed myocardial infarction or hypertrophy using an ECG independent gold standard are, so far, not generally available. Serial ECG analysis is to a great extent a pattern recognition task for the human expert which is difficult to translate into a rule-based structure. Most interpretation programs are still based on such a structure which thus is likely to result in serial analysis with performance inferior to that of the neural network approach. In order to improve the performance of rule-based analysis, recent efforts have been presented which consider smooth decision functions rather than binary threshold functions (18). This approach was found to reduce problems associated with modest variations in waveform measurements and therefore improved the repeatability of serial analysis. In this study, the gold standard was defined by the human interpretation of serial ECG recordings. It is obvious that such a standard is likely to favour the results of the ECG-based analysis, rather than those of the VCG-based analysis. Therefore, since both types of analysis resulted in almost identical performance figures VCG-based analysis should be preferred, especially when considering that its measurement vector has much lower dimensionality. Although a gold standard based on joint ECG and VCG interpretation is preferable, few human
68
SUNEMARK ET AL.
interpreters are experienced in serial analysis based on VCG loops. Ultimately, an ECG/VCG independent gold standard would be the best approach but was not practically feasible for the present study. It is interesting to note that global measurements related to VCG loop morphology, such as the singular values, have an information content which is similar to that of traditional ‘‘local’’ ECG wave measurements, e.g. Q and R wave amplitudes. This result implies that the difficulties often associated with accurate measurements of ECG waveform properties can be circumvented by relying instead of loop measurements which are much more immune to poor signal quality. The least-squares technique for loop alignment has earlier been successfully applied to the compensation of respiratory activity when measuring morphologic beat-to-beat variability (13). In that study, beat-to-beat analysis implied that loop alignment was performed on loops which initially were reasonably wellaligned; i.e., the beat-to-beat variation in estimated rotation angles and scale factor was typically limited to 610%. On the other hand, serial analysis implied in a few cases in this study that considerable changes in loop orientation occurred from one recording to another. As a result, the loop alignment was no longer a ‘‘well-posed’’ problem and therefore produced rotation angles which, although the error norm was minimized, resulted in an unacceptable loop transformation (in one case, the loop was flipped approximately 1808 in order to minimize the norm which obviously is an unrealistic rotation). Unfortunately, the formulation of the loop alignment problem in Eq. [1] does not easily lend itself to an optimization which embraces various parameter constraints. In this respect, it is likely that the CAVIAR technique for loop alignment better handles the inclusion of such constraints since it employs a gradient-based optimization technique. 5. CONCLUSIONS The results indicate that serial analysis based on VCG or ECG measurements and neural network classification is a promising way to increase the sensitivity at a given specificity. The best results were obtained when a combination of ECG and VCG measurements were used. The neural network approach appears to be less sensitive to the influence of various extracardiac factors otherwise compensated for by techniques for VCG loop alignment. ACKNOWLEDGMENT This work was supported by the Swedish National Board for Technical Development (NUTEK) Grants.
REFERENCES 1. Willems, J., Abreu-Lima, C., Arnaud, P., van Bemmel, J., Brohet, C., Degani, R., Denis, B., Gehring, J., Graham, I., van Herpen, G., Machado, H., Macfarlane, P., Michaelis, J., Moulopoulos, S., Rubel, P., and Zywietz, C. The diagnostic performance of computer programs for the interpretation of electrocardiograms, N. Engl. J. Med. 325, 1767–1773 (1991).
SERIAL VCG/ECG ANALYSIS
69
2. Pryor, T., Lindsay, A., and England, R. Computer analysis of serial electrocardiograms, Comput. Biomed. Res. 5, 709–720 (1972). 3. Rubel, P., Fayn, J., Willems, J., and Zywietz, C. New trends in serial ECG analysis, J. Electrocardiology 26 (Suppl.), 122–128 (1993). 4. MacFarlane, P., and Latif, S. Automated serial ECG comparison based on the Minnesota code, J. Electrocardiology 29 (Suppl.), 29–34 (1996). 5. Hertz, J., Krogh, A., and Palmer, R. ‘‘Introduction to the Theory of Neural Computation,’’ Addison–Wesley, Redwood City, CA, 1991. 6. Hede´n, B., Ohlsson, M., Edenbrandt, L., Rittner, R., Pahlm, O., and Peterson, C. Artificial neural networks for recognition of electrocardiographic lead reversal, Am. J. Cardiol. 75, 929–933 (1995). 7. Hede´n, B., Ohlsson, M., Edenbrandt, L. Rittner, R., Pahlm, O., and Peterson, C. Agreement between artificial neural networks and human expert for the electrocardiographic diagnosis of healed myocardial infarction, J. Am. Coll. Cardiol. 28, 1012–1016 (1996). 8. Tolan, G. Vectrocardiogram serial comparison using modern communication and control theory techniques, in ‘‘Computers in Cardiology,’’ 493–496, IEEE Comput. Soc., New York, 1981. 9. Gro¨ttum, P. Real-time serial analysis of infarctional changes in the vectorcardiogram, Comput. Biomed. Res. 18, 205–219 (1985). 10. Fayn, J. ‘‘Serial Analysis of Electrocardiograms—An Optimal Approach by Comparison of Space-Time Wire Images,’’ Ph.D. thesis, L’Institut National des Sciences Appliquees de Lyon, 1990. 11. Fayn, J., Rubel, P., and Mohsen, N. An improved method for the precise measurement of serial ECG changes in QRS duration and QT interval, J. Electrocardiology 24 (Suppl.), 123–127 (1989). 12. Edenbrandt, L., and Pahlm, O. Vectorcardiogram synthesized from a 12-lead ECG: Superiority of the inverse Dower matrix, J. Electrocardiol. 21, 361–367 (1988). 13. So¨rnmo, L. Vectorcardiographic loop alignment and morphologic beat-to-beat variability, IEEE Trans. Biomed. Eng., in press. 14. Golub, G., and van Loan, C. ‘‘Matrix Computations,’’ 2nd ed., The Johns Hopkins University Press, Baltimore, 1989. 15. Sunemark, M., Edenbrandt, L., Holst, H., and So¨rnmo, L. New techniques for serial ECG/VCG analysis, in ‘‘Proc. Med. Biol. Eng. Comput.,’’ Tampere, Finland, 1996. 16. Rumelhart, D., and McClelland, J. ‘‘Parallel Distributed Processing,’’ Vols. 1, 2, MIT Press, Cambridge, MA, 1986. 17. Peterson, C., Ro¨gnvaldsson, T., and Lo¨nnbald, L. JETNET 3.0—A versatile artificial neural network package, Comput. Phys. Commun. 81, 185–220 (1994). 18. McLaughlin, S., Chisthi, P., Aitchison, T., and Macfarlane, P. Techniques for improving overall consistency of serial ECG analysis, J. Electrocardiology 29 (Suppl.), 41–45 (1996).