Fears of an AI-controlled robot takeover aside, artificial intelligence has provided mankind with an incredible opportunity to leverage incredible computational power for use in a variety of ways, including things like cancer detection. But can a computer tell us when we’re likely to meet an untimely end?

Researchers from the University of Nottingham decided to find out, and what they discovered was that a machine learning system isn’t merely as good at predicting and individual’s chances of mortality as it is with illnesses, it’s actually better. The system, which digested the data of over 500,000 people, was able to guess which individuals would perish better than the models developed by human doctors.

The algorithm used in the study had to crunch an incredible amount of information, including the lifestyle differences and dietary habits of a massive chunk of the UK population.

“We have taken a major step forward in this field by developing a unique and holistic approach to predicting a person’s risk of premature death by machine-learning,” Dr. Stephen Weng, lead author of the work, said in a statement. “This uses computers to build new risk prediction models that take into account a wide range of demographic, biometric, clinical and lifestyle factors for each individual assessed, even their dietary consumption of fruit, vegetables and meat per day.”

The research team used data from the UK Biobank for over half a million people between the ages of 40 and 69. The data was collected between 2006 and 2016, and the algorithm was then tasked with predicting mortality rates of the group.

“We mapped the resulting predictions to mortality data from the cohort, using Office of National Statistics death records, the UK cancer registry and ‘hospital episodes’ statistics,” Weng says. “We found machine learned algorithms were significantly more accurate in predicting death than the standard prediction models developed by a human expert.”

The study, while impressive, is just one step in a larger effort to build machine learning systems capable of offering customized health outlooks for individuals. At some point in the not-so-distant future, computers may tell each of us what ailments pose the most danger, and how to beat them.