Scalable Multitask Learning Using Gradient-based Estimation of Task Affinity