An apparatus for detecting cardiac events in electrograms has a feature
extraction unit that derives features of the cardiac events for
discriminating among different types of cardiac events. A clustering unit
groups cardiac events with similar features into respective clusters
defined by predetermined cluster features. The feature extraction unit
determines a feature vector describing waveform characteristics of
cardiac events in the electrogram by a wavelet transform. The clustering
unit determines the distance between the feature vector and corresponding
cluster feature vectors in order to assign the cardiac event in question
to that cluster which results in a minimum distance, providing that the
minimum distance is less than a predetermined threshold value. A heart
stimulator provided with such a cardiac event detecting apparatus detects
the occurrence of an arrhythmia and appropriately controls a pulse
stimulator to treat the arrhythmia.