Robustness in machine learning and optimization, with limited structural knowledge