• Ingen resultater fundet

The discriminative properties of the models can not necessarily be related to the physiological process underlying the ECG. Since the choice of model parameters is based on the classification accuracy, there is a risk of capturing population specific properties of the ECG such as e.g. overall amplitude or noise. As both examples are likely to be specific to the data used in this work and not to normal and LQT2 ECGs in general, it is of interest to evaluate the generative properties of the models.

6.4.1 ECG Simulation

To evaluate the generative properties of the models a simulation can be per-formed where the best models, according to the classification accuracy, are ap-plied. Considering the HMM as a simulator, the transition matrix creates the sequence of hidden states, where each hidden state has an emission distribution with a mean and covariance. As such, there are two sources of randomness in a simulation. First, the generated sequence of hidden states will not be strictly periodic and second the covariance matrix associated with the mean emission values introduces a further source of randomness. Preferably, an ECG simulation of some fixed time length should be generated iteratively and these realizations should be used to find an average ECG simulation of the model in question. However, this would require alignment of the different realizations such that each full ECG cycle or "heartbeat" would be aligned with that of the next sequence. This is not feasible in an automated fashion as the simulations vary considerably. To overcome the problem two measures were taken; the mean emission values were considered and an expected number of self-transitions were applied in the simulation. An exponential state duration is a characteristic of the Markov chain [55] and so the expected number of self-transitions, or duration, can then be defined as: where, di is the duration of state i andaii is the probability of self-transition.

This expectation can be applied when simulating the hidden state sequence;

when the sequence starts the expectation is calculated and rounded down to nearest integer and a sequence of this length is simulated. When the duration is complete, a new state is drawn. In the case of LR transitions with only one forward degree of freedom the next state drawn will always be the immediately following state. In the case where there are two forward degrees of freedom

6.4 Generative Properties 75

there will still be a source of variability, because when the duration is complete, the next state drawn has two outcomes. To accommodate that situation (when drawing a new state) the probability of self-transition is removed and the re-maining probabilities are normalized such that they sum to one. Thus, in the case of two forward degrees of freedom the next state is drawn according to a Bernoulli distribution. In the case of the full transition matrix this generalizes to the categorical distribution. In summary, taking expectation of the duration and considering only the mean emissions eliminates randomness for the LR type transition with one forward degree of freedom but leaves randomness in the non-self-transitions for the LR type transition with two forward degrees of freedom and the full type transition. Figure6.3illustrates a 35 state (1 Gaussian) ECG simulation of lead V5 for the one degree freedom LR type transition matrix.

In the left column the hidden state sequence is generated by random according to the transition matrix. The right column corresponds to the hidden state sequence generated by calculating the expected number of self-transitions. In the top row the emissions are simulated while applying the covariance matrix.

In the second row the variance of the mean emissions is shown by plotting the standard deviation. Row three shows the mean emissions and row four shows the corresponding state sequence.

6.4.2 Period of a Transition Matrix

The state sequence in the bottom row of Figure 6.3 suggests that a full pass through the transition matrix corresponds to a single heartbeat. Summing the number of self-transitions and inter state transitions yields the total number of transitions. If the number of transitions is considered to be a number of samples at a specified sampling frequency the "heart rate" of a transition matrix can be calculated. For the one forward degree of freedom LR type transition matrix it is straight forward to collect the total number of transitions as the result is independent of the initial state as long as the return to the initial state is monitored. In the two forward degrees of freedom LR transition type however, there is a source of randomness as mentioned before. Thus, it is necessary to simulate a number of realizations and find an average "heart rate" in this manner. The LR with two degrees of freedom can jump two states at a time, which will increase the modeled "heart rate". Also, experience shows that some states will be close to absorbing. It was chosen to limit number of self-transitions to 1e6 corresponding to aii = 0.999999 and run the LR with the two degrees of freedom calculation 100 times to find an average "heart rate". In the case of the full transition matrix the bookkeeping with regards to when the process returns to the initial state is more ambiguous in that it may, in theory, return at any time. Thus, the average "heart rate" of the transitions matrices are only

76 Model Identification

Figure 6.3: ECG simulation. In the left column the hidden state sequence is generated by random according to the transition matrix. The right column corresponds to the hidden state sequence generated by calculating the expected number of self-transitions. In the top row the emissions are simulated while applying the covariance matrix.

In the second row the variance of the mean emissions are shown by plotting the standard deviation. Row three shows the mean emissions and row four shows the corresponding state sequence.