Benchmark repository for optimization

Test Status Python 3.6+ codecov

BenchOpt is a package to simplify, make more transparent and more reproducible the comparisons of optimization algorithms.

BenchOpt is written in Python but it is available with many programming languages. So far it has been tested with Python, R, Julia and compiled binaries written in C/C++ available via a terminal command. If it can be installed via conda it should just work!

BenchOpt is used through a command line as documented in Command Line Interface (CLI) Documentation. Ultimately running and replicating an optimization benchmark should be as simple as doing:

$ git clone https://github.com/benchopt/benchmark_logreg_l2
$ benchopt install --env ./benchmark_logreg_l2
$ benchopt run --env ./benchmark_logreg_l2

Running these commands will fetch the benchmark files, install the benchmark requirements in a dedicated environment benchop_benchmark_logreg_l2 and give you a benchmark plot on l2-regularized logistic regression:

_images/sphx_glr_plot_run_benchmark_001.png

Learn how to Write a benchmark.

Install

This package can be installed through pip. To get the last release, use:

$ pip install benchopt

And to get the latest development version, you can use:

$ pip install -U https://github.com/benchopt/benchOpt/archive/master.zip

This will install the command line tool to run the benchmark. Then, existing benchmarks can be retrieved from git or created locally. To discover which benchmarks are presently available look for benchmark_* repositories on GitHub, such as for Lasso – l1-regularized linear regression. This benchmark can then be retrieved locally with:

$ git clone https://github.com/benchopt/benchmark_lasso.git

Example of command line usage on the Lasso benchmark

This section illustrates benchopt’s command line interface on the Lasso benchmark; the syntax is applicable to any benchmark.

To install all requirements and dependencies of the benchmark, run:

$ benchopt install --env ./benchmark_lasso

To run benchmarks on all datasets and with all solvers, run:

$ benchopt run --env ./benchmark_lasso

To run only the sklearn and celer solvers, on the simulated and finance datasets, run:

$ benchopt run --env ./benchmark_lasso -s sklearn -s celer -d simulated -d finance

Some solvers and dataset have parameters; by default all combinations are run. If you want to run a specific configuration, pass it explicitly, e.g., to run the python-pgd solver only with its parameter use_acceleration set to True, use:

$ benchopt run --env ./benchmark_lasso -s python-pgd[use_acceleration=True]

Use

$ benchopt run -h

to get more details about the different options read the Command Line Interface (CLI) Documentation.

Some available benchmarks

Notation: In what follows, n (or n_samples) stands for the number of samples and p (or n_features) stands for the number of features.

\[y \in \mathbb{R}^n, X = [x_1^\top, \dots, x_n^\top]^\top \in \mathbb{R}^{n \times p}\]
\[\min_w \frac{1}{2} \|y - Xw\|^2_2\]
\[\min_{w \geq 0} \frac{1}{2} \|y - Xw\|^2_2\]
\[\min_w \frac{1}{2} \|y - Xw\|^2_2 + \lambda \|w\|_1\]
\[\min_w \sum_{i=1}^{n} \log(1 + \exp(-y_i x_i^\top w)) + \frac{\lambda}{2} \|w\|_2^2\]
\[\min_w \sum_{i=1}^{n} \log(1 + \exp(-y_i x_i^\top w)) + \lambda \|w\|_1\]
\[\min_{w, \sigma} {\sum_{i=1}^n \left(\sigma + H_{\epsilon}\left(\frac{X_{i}w - y_{i}}{\sigma}\right)\sigma\right) + \lambda {||w||_2}^2}\]

where

\[\begin{split}H_{\epsilon}(z) = \begin{cases} z^2, & \text {if } |z| < \epsilon, \\ 2\epsilon|z| - \epsilon^2, & \text{otherwise} \end{cases}\end{split}\]
\[\min_{w} \frac{1}{n} \sum_{i=1}^{n} PB_q(y_i - X_i w) + \lambda ||w||_1.\]

where \(PB_q\) is the pinball loss:

\[\begin{split}PB_q(t) = q \max(t, 0) + (1 - q) \max(-t, 0) = \begin{cases} q t, & t > 0, \\ 0, & t = 0, \\ (1-q) t, & t < 0 \end{cases}\end{split}\]

Given some data \(X \in \mathbb{R}^{d \times n}\) assumed to be linearly related to unknown independent sources \(S \in \mathbb{R}^{d \times n}\) with

\[X = A S\]

where \(A \in \mathbb{R}^{d \times d}\) is also unknown, the objective of linear ICA is to recover \(A\) up to permutation and scaling of its columns. The objective in this benchmark is related to some estimation on \(A\) quantified with the so-called AMARI distance.

See benchmark_* repositories on GitHub for more.

Benchmark results

All the public benchmark results are available at BenchOpt Benchmarks results.

Publish results: You can directly publish the result of a run of benchopt on BenchOpt Benchmarks results. You can have a look at this page to Publish benchmark results.

Contents