  The reliable diagnosis of cardiac conditions through electrocardiogram (ECG)
analysis critically depends on accurately detecting P waves and measuring the
PR interval. However, achieving consistent and generalizable diagnoses across
diverse populations presents challenges due to the inherent global variations
observed in ECG signals. This paper is focused on applying the Q learning
reinforcement algorithm to the various ECG datasets available in the
PhysioNet/Computing in Cardiology Challenge (CinC). Five ECG beats, including
Normal Sinus Rhythm, Atrial Flutter, Atrial Fibrillation, 1st Degree
Atrioventricular Block, and Left Atrial Enlargement, are included to study
variations of P waves and PR Interval on Lead II and Lead V1. Q-Agent
classified 71,672 beat samples in 8,867 patients with an average accuracy of
90.4% and only 9.6% average hamming loss over misclassification. The average
classification time at the 100th episode containing around 40,000 samples is
0.04 seconds. An average training reward of 344.05 is achieved at an alpha,
gamma, and SoftMax temperature rate of 0.001, 0.9, and 0.1, respectively.
