Victoria Taylor, senior dietitian at the British Heart Foundation, said: "Previous research has suggested that intakes of three to five cups of coffee a day shouldn't affect the risk of developing heart and circulatory disease".
The researchers then confirmed their findings with more traditional analyses of two additional large study groups: the Cardiovascular Heart Study and the Atherosclerosis Risk in Communities Study.
Following the machine learning data analysis, Stevens and colleagues found that an extra cup of coffee every week is associated with a 7 percent lower risk of heart failure and an 8 percent lower risk of stroke.
Researchers re-analysed data from the Framingham Heart Study, a long-running U.S. investigation of heart disease risk factors involving thousands of participants.
"More research is needed before we can confidently say how coffee consumption may impact our heart health".
The researchers utilized data from a a nationwide observational study of stroke risk factors in people aged above 45, called "Reasons for Geographic and Racial Differences in Stroke" (REGARDS). Previous research has suggested that coffee's caffeine content, along with its antioxidant and anti-inflammatory properties, may be responsible for its presumed health benefits.
The machine result also pointed to red meat being a risk factor in heart failure and stroke, but due to differing definitions of red meat, they could not draw the same conclusion across all three studies.
Their results were recently presented at the American Heart Association's (AHA) Scientific Sessions 2017, held in Anaheim, CA.
Of the five dietary patterns, greater adherence to the plant-based diet had the strongest association with a decreased risk of incident heart failure when adjusted for age, sex and race of the participants and for other risk factors.
"It is important to note that this type of study design demonstrates an observed association, but does not prove cause and effect". That being said, it is now hard to verify these results because the definition of what constitutes "red meat" differs between studies.
Foods to avoid include refined carbohydrates, foods high in added sugars, trans fats, saturated fats and processed meats. Instead, they suggest replacing it with chicken, fish, and beans. Although caffeine seems bad for the heart, consuming it regularly can prevent people from suffering both strokes and heart failure.
The study was carried out using an artificially intelligent machine-learning system.
Scientists recruited 15,569 participants for the diet study whose health was monitored for four years. Nearly all of the coffee drinkers in the study (97%) consumed between one and six cups of coffee a day, says Stevens, so the researchers can't know for sure if the benefits continue at even higher consumption levels. But coffee consumption also showed up as a significant predictor of stroke and heart failure.
"In an ideal world, we would be able to predict cardiovascular disease and stroke with 100% accuracy long before the occurrence of the event", said first author Laura Stevens, a doctoral student at the University of Colorado School of Medicine, in an email to TIME.
The researchers say the methods used in this study could help identify other, yet-unknown risk factors for heart failure and stroke.