Simple and scalable algorithms for cluster-aware precision medicine