This study aims to develop an automatic detector of the A phases of the cyclic alternating pattern, periodic activity that generally occurs during non-REM (NREM) sleep. Eight polysomnographic recordings from healthy subjects were examined. From EEG recordings, five band descriptors, an activity descriptor and a variance descriptor were extracted and used to train different machine-learning algorithms. A visual scoring provided by an expert clinician was used as golden standard. Four alternative mathematical machine-learning techniques were implemented: (1) discriminant classifier, (2) support vector machines, (3) adaptive boosting, and (4) supervised artificial neural network. The results of the classification, compared with the visual analysis, showed average accuracies equal to 84.9 and 81.5% for the linear discriminant and the neural network, respectively, while AdaBoost had a slightly lower accuracy, equal to 79.4%. The SVM leads to accuracy of 81.9%. The performance achieved by the automatic classification is encouraging, since an efficient automatic classifier would benefit the practice in everyday clinics, preventing the physician from the time-consuming activity of the visually scoring of the sleep microstructure over whole 8-h sleep recordings. Finally, the classification based on learning algorithms would provide an objective criterion, overcoming the problems of inter-scorer disagreement.