It may be one of the hardest questions a doctor has to answer, how long people will live. Now, the same technology that Google and Amazon use may be able to give patients the answers they are so desperate to hear.

Stewart seaward spends several hours a week working out in the gym. Ironically, he was on a treadmill a few years ago when he found out he had a heart condition.

“I went to my family physician and he put me on a treadmill and said, looks like you’ve had a heart attack,” said Stewart seaward, Ph.D.

Every day, Cardiologist Eric Adler sees patients like Stewart, suffering from congestive heart failure.

“My day job is deciding who needs heart transplants. And you can imagine, we don’t want to be wrong,” said Eric Adler, MD, Cardiologist, University of California San Diego Health.

Two months, two years, longer? Until now, cardiologists would compare tests themselves and make their best-educated guess.

“We don’t have a crystal ball and that’s often the most difficult situation we’re put into,” said Doctor Adler.

Avi Yagil wanted to know. In the ICU and suffering from congestive heart failure, this physicist came up with the idea of using the same machine learning technology that amazon and google use to learn about their users and patients like himself.

“It takes the information we have, and it looks at the relationship between them,” said Doctor Adler.

The algorithm creates a risk score from eight variables already collected for the majority of patients.

“Are you going to live longer than three months and are you going to live longer than two years?” asked Doctor Adler.

Giving doctors a multi-dimensional picture of each patient, the algorithm achieved an 88 percent success rate compared to just 50% before.

“That changes what resources we apply to them,” said Doctor Adler.

Stewart’s working out hard, hoping to add years to his life and says the more information available, the better.

Doctor Adler and his team believes this is just the tip of the iceberg for using A.I. in the medical field. But before it can be distributed to other hospitals, they’re working on ways to protect the information.