Alzheimer's disease is notoriously difficult to diagnose — the only way doctors can tell for sure that a patient has the deadly neurodegenerative condition is to examine his or her brain during an autopsy after death.

That uncertainty is hard on patients who are starting to experience memory loss, which could be an early sign of Alzheimer's or another, more treatable form of dementia. It also poses a major challenge to the researchers who are working to come up with effective treatments for the disease, which afflicts some 5 million Americans.

But now artificial intelligence is learning to do what doctors can't.

Get the mach newsletter. This site is protected by recaptcha

Separate teams of scientists at the University of Bari in Italy and McGill University in Canada have created artificial intelligence algorithms that can look at brain scans of people who are exhibiting memory loss and tell who will go on to develop full-blown Alzheimer's disease and who won't.

"The technology we developed will accelerate the discovery of therapies for [Alzheimer's disease]," lead study author Sulantha Sanjeewa Mathotaarachchi, a software developer at McGill’s Translational Neuroimaging Lab, told NBC News MACH in an email. That's because AI can help scientists identify participants for drug or lifestyle interventions at the earliest stages of dementia.

At McGill, the researchers fed an algorithm 191 PET scans of the brains of patients experiencing a decline in memory and thinking abilities, a condition called mild cognitive impairment. The researchers taught the algorithm which of these people had gone on to develop Alzheimer’s and which had not. The key to telling the two groups apart is a protein called amyloid, which shows up in the brains of people with Alzheimer’s and those with mild cognitive impairment.

“To the naked eye of the physicians, amyloid images show a widespread distribution through the entire brain,” Mathotaarachchi wrote.

The difference in amyloid between the two groups is too subtle for humans to detect, but the AI system, called AIDDementia (short for Artificial Intelligence for Diagnosing Dementia), had no problem. When it analyzed a new set of 82 brain scans, it identified who would develop Alzheimer’s in the next two years with 84 percent accuracy.

Meanwhile, the University of Bari team employed a similar approach, training a system with MRI brain scans. Their algorithm uses patterns in brain cell connections to identify who will develop Alzheimer’s within the next decade.

Mathotaarachchi says the AI system will need to be improved before it is made available for use by doctors. He hopes to boost its predictive ability by training it to make use of other forms of brain imaging, including MRI scans. The system must also be trained with more diverse patient populations, so that it can learn to tell the difference not just between different types of dementia but also between dementia and other brain problems, such as stroke.

FOLLOW NBC NEWS MACH ON TWITTER, FACEBOOK, AND INSTAGRAM.