Type “website that predicts your death” into Google and you’ll be faced with a seemingly endless scroll of pages. There’s death-clock.org, and deathdate.info; fatefulday.eu, and deathtimer.com. Some of these destinations even appear vaguely scientific, for example by asking for your BMI and smoking habits, and others, less so. It’s a testament to the universality of the question that, until recently, seemed impossible to answer: When the hell am I gonna die?!

Thanks to recent advancements in the fields of [preventative healthcare] analytics (https://www.inverse.com/article/54182-medicare-medicaid-food-prescriptions), however, getting actual, science-backed answers to this deeply human question may soon be within reach thanks to the help of machine-learned algorithms.

Dr. Stephen Weng, who teaches epidemiology and data science at the University of Nottingham, tells Inverse that he and his research team have designed an A.I. system that’s “very accurate” — more precise, even, than the standard models currently in use — in predicting early death due to chronic disease. Their findings, published Wednesday in a special edition of a special edition of PLOS ONE, culled health data from roughly 500,000 middle-aged people in the U.K. BioBank, a long-term study investigating the relationship between genetic predisposition and environmental factors. Using that data, Weng’s algorithm was able to correctly identify the cases of early death (as opposed to who lived to the projected 80 year lifespan in the U.K.) roughly 79 percent of the time.

Death countdown clocks abound despite being less-than-scientific. Fatefulday.eu

Despite some notable setbacks, the hype around preventative healthcare has continued to grow in recent years, not just in doctors offices as a way to improve quality of life, but among insurance companies, in an attempt to cut down on per-person healthcare costs. Another recent study, also published in PLOS ONE, found that “prescribing” fruits and vegetables could save Medicare and Medicaid up to $40 billion in healthcare costs each year.

This push reached Weng and his team, who in 2017 developed a machine-learning algorithm to predict heart attacks and strokes using electronic health records; their initial study found their A.I. system accurately predicted cardiovascular risks nearly eight percent better than the guideline-based prediction models used by physicians.

Heartened by their initial success, the team decided to try to tackle a much more complicated task: predicting early death across a wide-range of diseases. For over a year, the team analyzed demographic, biometric, clinical and lifestyle factors for each individual participant, even taking into account their daily vegetable intake. They fed the data into two machine learning models: “Deep learning” and “random forest.”

Both models are based on a “trial and error” principle, explains Weng, interpreting a large amount of data to determine the correct answer. “Deep learning” mimics the neural network of a human brain, recognizing and then utilizing patterns. “Random forest” is based on a “decision tree,” tasked with deciding whether early death will occur or not based on a variety of risk factors.

“The key difference between machine-learning algorithms is that the decisions on how the predictions are being made and what the important risk factors which drive that decision are entirely determined by the system itself,” says Weng. “Whereas standard approaches, a human expert will select risk factors usually based on what the data shows or what prior evidence there was for its inclusion into the model in the first place.”

The next step, Weng says, is replicating the findings, which may be something of a challenge.

“Many of the algorithms developed in our field are essentially ‘black boxes’ where we don’t know how the system is developed and how we can implement them in a way that replicable,” said Weng. “We provided detailed methodology, results, and published all our code to the public domain.”

Despite his A.I. system’s success, Weng isn’t advocating for purely A.I.-based healthcare. Ultimately, he hopes to see machine-learned algorithms take on a “complementary role” in the medical landscape, aiding doctors in their practice, rather than replacing or upstaging them.