Margin-adaptive model selection in statistical learning