Multiclass and multilabel classification with stochastic dual coordinate ascent.
libsdca trains linear and kernel classifiers with the losses from my PhD work on top-k error, along with the standard multiclass and multilabel ones. It is a header-only C++11 library with a MATLAB interface, and it is the reference implementation of the top-k SVM (NeurIPS 2015) and the top-k entropy loss (CVPR 2016).
Stochastic dual coordinate ascent (Shalev-Shwartz and Zhang, 2013, 2016) works on the dual problem, one training example at a time. For these losses each step reduces to a small proximal problem, usually a projection onto a simplex-like set, and libsdca solves it exactly. The dual objective also gives a duality gap, a certificate of how far the current model is from the optimum, so you know when training is actually done instead of guessing from a learning curve.
W(exp(x))
(Corless et al., 1996)matsdca_fit and matsdca_prox
For the nonconvex truncated top-k entropy loss, see libsdca_gd in
v0.2.0.
From C++, add include/ to your include path and link a BLAS if you use the solver. The MATLAB
interface is two MEX files, built into matlab/ with CMake on Linux or macOS:
git clone https://github.com/mlapin/libsdca.git cd libsdca && mkdir build && cd build cmake .. && make install -j4
or from MATLAB itself:
run matlab/make.m addpath matlab
model = matsdca_fit(X, Y, opts); % train
matsdca_fit('help') % list objectives and options
matsdca_prox('help', 'prox') % list proximal operators
A complete example is in matlab/demo.m.
The losses demo trains softmax, multiclass SVM, top-k SVM, and top-k entropy side by side in your browser on the synthetic problem from the CVPR 2016 paper. The simplex demo runs the projection onto the top-k simplex that the top-k SVM update relies on. Both are JavaScript reimplementations rather than libsdca itself, but the math is the same.
If libsdca helps your research, please cite the paper for the losses you use.
@inproceedings{lapin2015topk,
title = {Top-k Multiclass {SVM}},
author = {Lapin, Maksim and Hein, Matthias and Schiele, Bernt},
booktitle = {NeurIPS},
year = {2015}
}
@inproceedings{lapin2016loss,
title = {Loss Functions for Top-k Error: Analysis and Insights},
author = {Lapin, Maksim and Hein, Matthias and Schiele, Bernt},
booktitle = {CVPR},
year = {2016}
}
The journal version adds the multilabel losses and the calibration analysis:
@article{lapin2018analysis,
title = {Analysis and Optimization of Loss Functions for Multiclass, Top-k, and Multilabel Classification},
author = {Lapin, Maksim and Hein, Matthias and Schiele, Bernt},
journal = {IEEE TPAMI},
volume = {40},
number = {7},
pages = {1533--1554},
year = {2018}
}