Constrained Optimization to Train Neural Networks on Critical and Under-Represented Classes