Output-sensitive ERM-based techniques for data-driven algorithm design