Simulated Data for Linear Regression with Structured and Sparse Penalties: Introducing pylearn-simulate

Tommy Löfstedt, Vincent Guillemot, Vincent Frouin, Édouard Duchesnay, Fouad Hadj‐SelemJournal of Statistical Software 2018

Abstract: A currently very active field of research is how to incorporate structure and prior knowledge in machine learning methods. It has lead to numerous developments in the field of non-smooth convex minimization. With recently developed methods it is possible to perform an analysis in which the computed model can be linked to a given structure of the data and simultaneously do variable selection to find a few important features in the data. However, there is still no way to unambiguously simulate data to test proposed algorithms, since the exact solutions to such problems are unknown. The main aim of this paper is to present a theoretical framework for generating simulated data. These simulated data are appropriate when comparing optimization algorithms in the context of linear regression problems with sparse and structured penalties. Additionally, this approach allows the user to control the signal-to-noise ratio, the correlation structure of the data and the optimization problem to which they are the solution. The traditional approach is to simulate random data without taking into account the actual model that will be fit to the data. But when using such an approach it is not possible to know the exact solution of the underlying optimization problem. With our contribution, it is possible to know the exact theoretical solution of a penalized linear regression problem, and it is thus possible to compare algorithms without the need to use, e.g., cross-validation. We also present our implementation, the Python package pylearn-simulate, available at https://github.com/neurospin/pylearn-simulate and released under the BSD 3-clause license.

Introduction: The Challenge of Benchmarking Optimization

When researchers develop new optimization solvers for penalized linear regression, they face a fundamental validation hurdle: how do you prove your algorithm actually reaches the global minimum? The standard approach in machine learning research is to pick a "true" vector $\beta^*$, generate a random matrix $X$, and create targets $y = X\beta^* + \epsilon$.

However, this approach contains a subtle but significant flaw. Once a penalty (such as an $L_1$ norm for sparsity) is added to the objective function, the $\beta$ that minimizes the new penalized objective is almost never the original $\beta^*$ used to generate the data. Because exact mathematical solutions to these complex, non-smooth problems are generally unknown for arbitrary data, researchers often rely on "relative convergence" or cross-validation. This makes it impossible to determine if an algorithm is truly hitting the global minimum or merely stagnating near it.

Methodology: Reverse-Engineering the Optimality Condition

To address this, the authors introduce a theoretical framework that generalizes a technique originally proposed by Yurii Nesterov for LASSO. Instead of generating data and searching for the minimum, the framework starts with the desired minimum ($\beta^*$) and a candidate data matrix ($X_0$), then modifies the data to fit the solution.

The core logic relies on the optimality condition: for a convex function $f$, a point $\beta^*$ is a global minimizer if and only if zero is in its subdifferential ($0 \in \partial f(\beta^*)$). The process follows three main steps:

  1. Subdifferential Scaling: The algorithm calculates the subdifferential of the chosen penalties (e.g., $L_1, L_2$, Total Variation) at $\beta^*$.
  2. Data Transformation: It scales the columns of the candidate matrix $X_0$ by specific factors ($\omega_j$) to ensure that the gradient of the loss function perfectly cancels out the subdifferential of the penalties at exactly $\beta^*$.
  3. SNR Control: To ensure the data remains realistic, the framework provides a method to control the Signal-to-Noise Ratio (SNR). Finding the correct scaling factor to hit a target SNR is shown to be equivalent to finding the positive root of a fourth-order polynomial.

The pylearn-simulate Package

The authors released pylearn-simulate, an object-oriented Python package that implements these methods. The tool allows for the generation of datasets tailored to specific optimization problems, including those involving Total Variation, Group LASSO, and overlapping penalties.

Synthetic Benchmarks and Candidate Matrices

Rather than relying on external datasets, the tool focuses on the generation of datasets. For example, the authors demonstrate the tool by generating a 24-dimensional vector representing a small 3D image ($2 \times 3 \times 4$ voxels) to test Total Variation penalties. Crucially, the tool allows users to input any candidate matrix $X_0$ (such as real-world gene expression data), which the software then transforms into a "quasi-real" dataset with a known exact solution.

Key Insights and Results

  • The "Exact Solution" Guarantee: The most important takeaway is the shift from "simulating data from a model" to "simulating data for an optimization problem." This allows for the calculation of absolute error ($f(\beta^{(k)}) - f(\beta^*)$), providing a "perfect" benchmark for solver performance.
  • Unified Framework for Complex Penalties: The authors demonstrate that many complex penalties can be decomposed into a common form: the sum of compositions of norms and linear operators. This makes their scaling algorithm highly extensible to new research.
  • Bypassing Cross-Validation: Because the exact theoretical solution is known, researchers can compare the speed and accuracy of different solvers (like FISTA or CONESTA) without the computational overhead of cross-validation.
  • Validation: Through simulations, the authors show that standard solvers reach the minimum at exactly the pre-defined $\beta^*$, whereas classical simulations often result in an "optimal" solution that differs significantly from the "true" vector.

Limitations and Future Work

The current framework is specifically designed for linear least-squares loss. Extending this "reverse-engineering" of the optimality condition to non-linear losses, such as logistic regression, remains a primary goal for future research, as the relationship between the data matrix $X$ and the target vector $y$ is more implicit in those models.

Reference: Löfstedt T, Guillemot V, et al. (2018). "Simulated Data for Linear Regression with Structured and Sparse Penalties: Introducing pylearn-simulate." Journal of Statistical Software, 87(3).

Summary updated

BibTeX
@article{lofstedt2018simulated,
  author = {Tommy Löfstedt and Vincent Guillemot and Vincent Frouin and Édouard Duchesnay and Fouad Hadj‐Selem},
  title = {{Simulated Data for Linear Regression with Structured and Sparse Penalties: Introducing <b>pylearn-simulate</b>}},
  journal = {Journal of Statistical Software},
  year = {2018},
  doi = {10.18637/jss.v087.i03},
}
Figure