I have the feeling that you can vectorize this loop.
By first performaing `predict_proba`, then computing what you want.