OK computer: is it ethical to allow AI to determine when patients should die?

An algorithm analysing Facebook can outperform a spouse in predicting a person's personality trait, say researchers

A question. For a patient with advanced dementia, do you think it would be acceptable for artificial intelligence in the form of a computer algorithm to make medical decisions on their behalf, including the decision to cease treatment altogether?