When to Intervene: Learning Optimal Intervention Policies for Critical Events