Artificial intelligence can predict when patients with a heart disorder will die, according to scientists.
The software learned to analyse blood tests and scans of beating hearts to spot signs that the organ was about to fail.
The team, from the UK's Medical Research Council, say the technology could save lives by finding patients that need more aggressive treatment.
The results were published in the journal Radiology.
The researchers, at the MRC London Institute of Medical Sciences, were investigating patients with pulmonary hypertension.
High blood pressure in the lungs damages part of the heart, and about a third of patients die with five years of being diagnosed.
There are treatments: drugs, injections straight into the blood vessels, a lung transplant.
But doctors need to have an idea of how long patients might have left, in order to pick the right treatment.
The software was given MRI scans of 256 patients' hearts, and blood test results.
It measured the movement of 30,000 different points in the organ's structure during each a heartbeat.
When this data was combined with eight years of patient health records, the artificial intelligence learned which abnormalities predicted when patients would die.
The software could look about five years into the future.
It correctly predicted those who would still be alive after one year about 80% of the time. The figure for doctors is 60%.
Dr Declan O'Regan, one of the researchers, told the BBC News website: "The AI really allows you to tailor the individual treatment.
"So it takes the results of dozens of different tests including imaging, to predict what's going to happen to individual patients very accurately.
"So we can tailor getting absolutely the right intensive treatment to those who will benefit the most."
The team now want to test the software works in other patients in different hospitals before assessing whether it should be made widely available to doctors.
The researchers also want to use the technology in other forms of heart failure, such as cardiomyopathy, to see who might need a pacemaker or other forms of treatment.
Dr Mike Knapton, from the British Heart Foundation, said: "This exciting use of computer software in clinical practice will help doctors in the future to make sure that patients are receiving the correct treatment before the condition deteriorates and leaves them needing a lung-transplant.
"The next step is to test this technology in more hospitals."
Follow James on Twitter.