On the Design of Loss Functions for Classification: theory, robustness to outliers, and SavageBoost