Researchers have developed an AI algorithm that can improve sleep disorder diagnoses, treatments, and our overall understanding of the debilitating condition that affects millions around the world.

The study was conducted by researchers from the University of Copenhagen’s Department of Computer Science in collaboration with the Danish Center for Sleep Medicine at the Danish hospital, Rigshospitalet. Difficulty sleeping, sleep apnea and narcolepsy are among a range of sleep disorders that thousands of Danes suffer from. Furthermore, it is estimated that sleep apnea is undiagnosed in as many as 200,000 Danes.

“The algorithm is extraordinarily precise,”claims Mathias Perslev, a PhD at the Department of Computer Science and lead author of the study, published in Digital Medicine.“We completed various tests in which its performance rivalled that of the best doctors in the field, worldwide.”

Sleep disorder examinations typically begin with admittance to a sleep clinic, where, a person’s night sleep is monitored using various measuring instruments. A specialist in sleep disorders then reviews the 7-8 hours of measurements from the patient’s overnight sleep.

The doctor manually divides these 7-8 hours of sleep into 30-second intervals, all of which must be categorized into different sleep phases, such as REM (rapid eye movement) sleep, light sleep, deep sleep, etc. It is a time-consuming job that the algorithm can perform in seconds.

“This project has allowed us to prove that these measurements can be very safely made using machine learning – which has great significance. By saving many hours of work, many more patients can be assessed and diagnosed effectively,” explains Poul Jennum, professor of neurophysiology and Head of the Danish Center for Sleep Medicine.

In the Capital Region of Denmark alone, more than 4,000 polysomnography tests – known as PSG or sleep studies – are conducted annually on patients with sleep apnea and more complicated sleeping disorders. It takes 1.5-3 hours for a doctor to analyze a PSG study. Thus, in the Capital Region of Denmark alone, between 6,000 and 12,000 medical hours could be freed up by deploying the new algorithm.

By collecting data from a variety of sources, the researchers behind the algorithm have been able to ensure optimal functionality. In all, 20,000 nights of sleep from the United States and a host of European countries have been collected and used to train the algorithm.

“We have collected sleep data from across continents, sleep clinics and patient groups,”explains Mathias Perslev. “The fact that the algorithm works well under such diverse conditions is a breakthrough. Achieving this kind of generalization is one of the greatest challenges in medical data analysis.”

They hope that the algorithm will serve to help doctors and researchers around the world to learn more about sleep disorders in the future. The sleep analysis software is freely available at and can be used by anyone, anywhere – including places where there isn’t a sleep clinic around the corner.

“Just a few measurements taken by common clinical instruments are required for this algorithm. So, use of this software could be particularly relevant in developing countries where one may not have access to the latest equipment or an expert,” says Mathias Perslev.

The researchers are now working with Danish physicians to get the software and algorithm approved for clinical use.