Death in Game of Thrones has always been gloriously unpredictable. Just when you’re getting to like a character (or, at least, grudgingly respect them), they end up beheaded, impaled, barbecued, or exploded, leaving you wondering: who’s next?

With the final season of the show underway, a team at the Technical University of Munich (TUM) has attempted to answer this question using basic data science and some fancy machine learning.

Their top prediction to survive season 8? None other than the Mother of Dragons herself, Daenerys Targaryen, with a slim 0.9 percent probability of dying. The character most likely to kick the medieval bucket, meanwhile, is everyone’s favorite sellsword: Ser Bronn of the Blackwater, with a 93.5 percent chance of dying.

Warning: Spoilers ahead for the previous seasons of Game of Thrones.

To make their predictions, the team at TUM used approaches familiar to medicine and life insurance. They mined statistical information about how long people lived, along with biographical data that might correlate to when they die. In real life, that might include information like whether someone is a smoker or how frequently they exercise. But in the world of Game of Thrones, the more relevant information is what house a particular character belongs to, whether they’re married, and who their allies are.

The house a character belongs to affects how likely they are to die

With the help of fan-maintained Wikis, TUM’s data scientists combed through the lives of hundreds of characters. Along with collecting in-universe data like their gender and location, they also included what we might call metadata: information like whether someone is a major or minor character and how often they’re cited in fan Wikipedias.

This data revealed some basic truths about mortality and the Game of Thrones universe, such as the fact that being male is more dangerous than being female. (Men have a 22 percent death rate, compared to 11 percent for women.) Certain houses are more long-lived than others, reflecting their ascendancy in Westeros. Being a Baratheon, for example, makes you 5 percent more likely to die than the average character, while being a Lannister makes you 45 percent more likely to survive.

To turn these trends into predictions for individual characters, the team analyzed this data using two separate models: the first used a fairly straightforward statistical approach known as Bayesian inference, and the second relied on fancier techniques involving machine learning and neural networks.

Based on these methods, the character deemed most likely to survive is Daenerys Targaryen. She’s followed by Tyrion Lannister (2.5 percent chance of death), Varys (3.2 percent), and Samwell Tarly (3.3 percent). On the other end of the spectrum, Bronn is deemed most likely to die, followed by Gregor Clegane (80.3 percent), Sansa Stark (73.3 percent), and Bran Stark (57.8 percent). (For a full list of predictions, you should check out the dedicated site where you can look up the survival rates of individual characters.)

Speaking to The Verge, Guy Yachdav, the project’s lead, said some of these predictions were a bit of a surprise. “Sansa Stark’s high chances of being eliminated was completely unexpected for us and we are finding it hard to explain,” says Yachdav. “Cersei Lannister’s low chances of being eliminated was also unexpected but can be explained by the fact that she is a member of house Lannister, a relatively ‘safe’ house in Game of Thrones terms.”

The question is, how good are these predictions anyway? It’s impossible to say for sure, but they’re certainly not a bad start if you felt like laying some bets on season 8.

The team at TUM created a similar model back in 2016, which predicted that the five characters most likely to die were Tommen Baratheon (97 percent chance of death), Stannis Baratheon (96 percent), Daenerys Targaryen (95 percent), Davos Seaworth (91 percent), and Petyr Baelish (91 percent).

The algorithm’s predictions in 2016 were mostly correct

Looking back, we can see that most (but not all) of these predictions came true: Tommen jumped out of a window at the end of season 6, Stannis was finished off by Brienne of Tarth at the end of season 5, and Petyr was a recipient of Stark justice at the end of season 7. But both Dany and Davos are still very much alive and kicking, despite the algorithm’s grim predictions, showing the ultimate fallibility of such models.

Speaking to Wired.co.uk, one of the data scientists involved in the project, researcher Christian Dallago, noted that the predictions were muddied somewhat when the plot of the TV show overtook writer George R.R. Martin’s source material, A Song of Ice and Fire.

“So Daenerys is right now, according to aggregate, predicted a 0.9 percent likelihood of death, and three years ago, we predicted her to be 95 percent likely to die,” said Dallago. “But since that season, George R.R. Martin has lost control and other writers are writing the story. It’s a little bit differently from originally intended, and that seems to have really had an effect on the data.”

One of The Verge’s resident GoT experts, Chaim Gartenberg, agreed, noting that death in the show was much more unpredictable when following Martin’s “vicious hand.” As the show has gone on, certain characters, like Daenerys, have become much safer, simply because they’re essential to moving the plot forward.

Also, because the models the researchers created are using historical data to make their predictions, they’re necessarily blind to any future political twists and turns. For example, while being a member of the current ruling clan, House Lannister, might be good for your survival rates now, once the various armies in play in season 8 start marching on King’s Landing, it could turn into a bit of a liability.

For the creators of TUM’s algorithm, the proof will be in the pudding. “We are watching the new episodes closely and will post a list that keeps track of whether we were able to correctly predict a character’s elimination or whether we didn’t see it coming,” says Yachdav.

Update April 16th, 4:30AM ET: Updated with additional comment from TUM.