IntroductionPerinatal women tend to have difficulties with sleep along with autonomic characteristics. This study aimed to identify a machine learning algorithm capable of achieving high accuracy in predicting sleep–wake conditions and differentiating between the wake conditions before and after sleep during pregnancy based on heart rate variability (HRV).MethodsNine HRV indicators (features) and sleep–wake conditions of 154 pregnant women were measured for 1 week, from the 23rd to the 32nd weeks of pregnancy. Ten machine learning and three deep learning methods were applied to predict three types of sleep–wake conditions (wake, shallow sleep, and deep sleep). In addition, the prediction of four conditions, in which the wake conditions before and after sleep were differentiated—shallow sleep, deep sleep, and the two types of wake conditions—was also tested.Results and DiscussionIn the test for predicting three types of sleep–wake conditions, most of the algorithms, except for Naïve Bayes, showed higher areas under the curve (AUCs; 0.82–0.88) and accuracy (0.78–0.81). The test using four types of sleep–wake conditions with differentiation between the wake conditions before and after sleep also resulted in successful prediction by the gated recurrent unit with the highest AUC (0.86) and accuracy (0.79). Among the nine features, seven made major contributions to predicting sleep–wake conditions. Among the seven features, “the number of interval differences of successive RR intervals greater than 50 ms (NN50)” and “the proportion dividing NN50 by the total number of RR intervals (pNN50)” were useful to predict sleep–wake conditions unique to pregnancy. These findings suggest alterations in the vagal tone system specific to pregnancy.