Safe Grid Search with Optimal Complexity

Eugène Ndiaye, Tam Le, Olivier Fercoq, Joseph Salmon, Ichiro Takeuchi

Abstract

Regularization parameter selection is a cornerstone of modern machine learning, typically addressed via grid search. However, standard grid search methods often lack theoretical guarantees and computational efficiency. This paper introduces a "Safe Grid Search" framework that adaptively approximates the regularization path for models such as Lasso and Logistic Regression. By leveraging duality gaps as optimality certificates and accounting for the curvature of loss functions, the proposed method constructs an $\epsilon$-path with guaranteed precision. We prove that this approach achieves optimal complexity for various classes of loss functions. Empirical evaluations on high-dimensional datasets demonstrate that our adaptive grid significantly reduces computational costs while maintaining global convergence guarantees for validation error.

Introduction

In machine learning, the regularization parameter $\lambda$ balances model fit and complexity. Finding the optimal $\lambda$ usually involves training a model across a sequence of values—a process known as grid search. Despite its ubiquity, standard grid search suffers from several drawbacks: brute-force heuristics often lead to redundant computations or missed optima, and "exact" path algorithms like LARS are often numerically unstable or limited to specific linear models. Furthermore, practitioners rarely have theoretical guarantees that the best $\lambda$ found on a discrete grid is close to the true optimal value for the validation error.

This work addresses these issues by proposing a unified framework for constructing a "safe" grid. This grid ensures that for any $\lambda$ within a specified range, the provided solution is within a tolerance $\epsilon$ of the optimal objective value.

Methodology

The core of the proposed framework is the construction of an $\epsilon$-path. This is achieved through several key technical components:

Duality Gaps and Curvature

The algorithm utilizes the duality gap—the difference between the primal and dual objective functions—as a certificate of optimality. By monitoring this gap, the algorithm can rigorously bound the approximation error. The step size between consecutive $\lambda$ values is not fixed; instead, it is adaptively calculated based on the mathematical properties of the loss function, specifically its curvature.

For uniformly convex losses, the complexity is shown to be $O(1/\sqrt[d]{\epsilon})$, while for Generalized Self-Concordant functions (such as Logistic Regression), it is $O(1/\sqrt{\epsilon})$. This curvature-aware approach allows for much tighter bounds and more efficient hyperparameter exploration than previously possible.

Adaptive Grid Selection

Unlike traditional methods that use a fixed log-scale grid, our algorithm determines the next $\lambda$ point based on the regularity of the loss. This ensures that the duality gap remains below the target threshold $\epsilon$ throughout the entire path.

Adaptive selection of grid points $\lambda_k$ based on the upper bound of the duality gap.

Safe Validation Path and Automatic Stopping

The framework extends to the validation set, providing a "safe" region where the validation error is guaranteed to be close to the minimum. This allows the algorithm to skip unpromising hyperparameter regions. Additionally, the method automatically calibrates the stopping criterion for the training optimization based on the desired final accuracy on the validation set, preventing over-optimization on training data when it does not benefit validation performance.

Experimental Evaluation

The authors evaluated the "Safe Grid Search" on several standard benchmarks, ranging from synthetic data to high-dimensional real-world datasets:

  • Synthetic Data: Generated via sklearn to test controlled regression and sparsity scenarios.
  • Diabetes and Leukemia: Classic small-scale and high-dimensional ($p=7129$) datasets.
  • NCEP/NCAR Reanalysis: A large climate dataset ($p=73577$).
  • E2006-log1p: A massive financial dataset ($n=16087, p=1668737$) demonstrating the scalability of the approach.

Key Results

  • Efficiency: On high-dimensional datasets like the NCEP climate data, the adaptive grid reached target accuracy with significantly fewer grid points and lower total computational time compared to standard "default" grids used in packages like glmnet or sklearn.
  • Global Convergence: The algorithm provides a global convergence guarantee for validation error, ensuring the selected hyperparameter is $\epsilon$-close to the best possible one, even when the validation curve is non-convex.
  • Optimal Complexity: Theoretical analysis confirms that the path construction achieves the theoretical lower bounds for complexity, making it optimal for the studied function classes.

Discussion and Conclusion

The "Safe Grid Search" framework provides a robust, theoretically grounded alternative to heuristic hyperparameter tuning. By bridging the gap between training optimization and validation performance, it offers significant practical benefits in terms of both speed and reliability.

Currently, the framework is focused on one-dimensional grids. Extending this logic to multi-dimensional hyperparameter spaces (e.g., for Elastic Net) is a promising direction for future research. Additionally, while the current work relies on convex optimization, adapting these principles to non-convex regimes, such as deep learning, remains an open challenge. Finally, integrating this grid search with "safe screening" techniques could further enhance computational efficiency in high-dimensional settings.

Summary updated

BibTeX
@inproceedings{ndiaye2019safe,
  author = {Eugène Ndiaye and Tam Le and Olivier Fercoq and Joseph Salmon and Ichiro Takeuchi},
  title = {{Safe Grid Search with Optimal Complexity}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
  url = {https://openreview.net/forum?id=ry-Ea9-dbS},
}
Figure