Learning with rare data: Using active importance sampling to optimize objectives dominated by rare events