Scalable inference of discrete data: user behavior, networks and genetic variation