It is no secret that timely diagnoses of heart ailments can prevent heart attacks and save lives. Heart attacks are hard to anticipate and doctors generally employ the American Heart Association’s (AHA) guidelines in diagnosing them.

A new method, which employs artificial intelligence (AI) based machine learning mechanisms, could change this — according to a new study published in Science Magazine Friday, scientists have demonstrated that computers capable of machine learning can perform better than standard medical guidelines.

Read: Artificial Intelligence Will Need New Laws

“I can’t stress enough how important it is and how much I really hope that doctors start to embrace the use of artificial intelligence to assist us in care of patients,” Elsie Ross, a vascular surgeon at Stanford University commented on the technological development.

Heart attacks are generally diagnosed based on risk factors such as age, cholesterol level and blood pressure. Physicians add up all these factors to inform you of heart attack risk. What is tough to account for, is the effect of the medicines a patient is on, other diseases and lifestyle factors and this is where AI comes in.

“There’s a lot of interaction in biological systems. That’s the reality of the human body. What computer science allows us to do is to explore those associations,” says Stephen Weng, an epidemiologist at the University of Nottingham in the United Kingdom.

In the study, Weng and his colleagues compared the use of standard AHA guidelines with four different machine-learning algorithms —Random Forest, Logistic Regression, Gradient Boosting and Neural Networks. The algorithms analyzed a large chunk of data comprising of the 2005 electronic medical records of 378,256 patients in the United Kingdom, in order to create predictive tools, which could work without human instruction. To do so, they first analyzed patterns that occur around the time that cardiovascular events such as heart attacks occur.

Read: Artificial Intelligence In Finance Predicts Stocks And Bonds

The researchers then retained 78 percent of the data to search for patterns and compared against the rest of the data. Using the tools, they then predicted, which patients were at the risk of a heart attack in the next 10 years.

In conclusion, they found that all four AI-based methods performed significantly better than AHA guideline based methods. The best one among them, Neural Networks, actually predicted 7.6 percent more heart attacks than the AHA guidelines based method.