Optimizing generalization on the train set: a novel gradient-based framework to train parameters and hyperparameters simultaneously

Karim Lounici, Katia Meziani, Benjamin RiuarXiv 2020

Abstract

Generalization is a central problem in Machine Learning. Most prediction methods require careful calibration of hyperparameters carried out on a hold-out validation dataset to achieve generalization. The main goal of this paper is to present a novel approach based on a new measure of risk that allows us to develop novel fully automatic procedures for generalization. We illustrate the pertinence of this new framework in the regression problem. The main advantages of this new approach are: (i) it can simultaneously train the model and perform regularization in a single run of a gradient-based optimizer on all available data without any previous hyperparameter tuning; (ii) this framework can tackle several additional objectives simultaneously (correlation, sparsity,...) via the introduction of regularization parameters. Noticeably, our approach transforms hyperparameter tuning as well as feature selection (a combinatorial discrete optimization problem) into a continuous optimization problem that is solvable via classical gradient-based methods; (iii) the computational complexity of our methods is $O(npK)$ where $n, p, K$ denote respectively the number of observations, features, and iterations of the gradient descent algorithm. We observe in our experiments a significantly smaller runtime for our methods as compared to benchmark methods for equivalent prediction score. Our procedures are implemented in PyTorch.

Introduction

In standard machine learning, achieving generalization—the ability of a model to perform well on unseen data—usually incurs a significant "tax." This tax manifests in two primary ways: data splitting, where a portion of the dataset must be set aside for validation, and computational cost, as tuning hyperparameters often requires exhaustive searches like grid search or Bayesian optimization.

This paper introduces the ER-G (Empirical Risk - Generalization) criterion, a novel framework that eliminates the need for a separate hold-out validation set. By redefining generalization as the ability to avoid finding patterns in non-informative data, the authors allow models to learn from the full dataset while simultaneously optimizing hyperparameters.

Methodology

The Permutation Trick

The core of the ER-G framework is the use of artificial datasets created by randomly permuting target labels ($Y$). This simulates a "non-informative" scenario. A model that generalizes effectively should perform significantly better on the original data than on this shuffled noise. The ER-G loss function balances standard empirical risk with a penalty based on the model's performance relative to these permutations.

Continuous Feature Selection

To handle high-dimensional data, the authors introduce a "quasi-sparsifying" operator. This mathematical technique uses a sigmoid-like function to "gate" features, transforming the traditionally discrete, combinatorial problem of feature selection into a continuous optimization problem. This allows the use of standard gradient-based optimizers, such as ADAM, to perform feature selection and weight optimization in a single pass.

Key Insights: Stability of Hyper-parameters

A significant advantage of this framework is that the number of permutations ($T$) used to estimate the noise baseline is not a sensitive hyperparameter. Experimental results show that predictive performance, measured by the $R^2$-score, stabilizes rapidly as $T$ increases.

R2-score stability across permutations T.

As seen in the figure above, using $T \approx 30$ is sufficient across various scenarios to achieve stable and competitive predictive accuracy, meaning users do not need to perform a secondary search to "tune the tuner."

Experimental Results

The authors evaluated the BKK (Bose-Kanda-Kone) framework against standard Scikit-learn implementations of RidgeCV, LassoCV, and Elastic-Net. Testing spanned synthetic scenarios (correlated and sparse settings) and real-world benchmarks, including the UCI repository and the high-dimensional 20news text dataset.

Massive Computational Speedups

The BKK framework demonstrated remarkable efficiency. Because it treats hyperparameters as differentiable parameters updated via gradient descent, it avoids the hundreds of training cycles required by traditional cross-validation.

Runtime comparison on real-world datasets.

On the UCI datasets, the BKK method achieved speedups of up to 123x compared to cross-validated benchmarks. On the 20news dataset, where $p \gg n$, the method remained approximately 20x faster while maintaining equivalent $R^2$ scores. Most models reached convergence in under 100 iterations of the ADAM optimizer.

Conclusion and Future Work

The ER-G framework represents a paradigm shift in how we approach generalization. By baking a "noise-check" directly into the loss function, it enables faster, more data-efficient training. While currently optimized for linear regression models with closed-form estimators, future research will focus on extending this permutation-based risk measure to non-linear architectures, classification tasks, and time-series data.

Summary updated

BibTeX
@misc{lounici2020optimizing,
  author = {Karim Lounici and Katia Meziani and Benjamin Riu},
  title = {{Optimizing generalization on the train set: a novel gradient-based framework to train parameters and hyperparameters simultaneously}},
  year = {2020},
  eprint = {2006.06705},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2006.06705},
}
Figure