Fast group lasso regularised linear models in a sklearnstyle API.
Project description
The group lasso [1] regulariser is a well known method to achieve structured sparsity in machine learning and statistics. The idea is to create nonoverlapping groups of covariates, and recover regression weights in which only a sparse set of these covariate groups have nonzero components.
There are several reasons for why this might be a good idea. Say for example that we have a set of sensors and each of these sensors generate five measurements. We don’t want to maintain an unneccesary number of sensors. If we try normal LASSO regression, then we will get sparse components. However, these sparse components might not correspond to a sparse set of sensors, since they each generate five measurements. If we instead use group LASSO with measurements grouped by which sensor they were measured by, then we will get a sparse set of sensors.
An extension of the group lasso regulariser is the sparse group lasso regulariser [2], which imposes both groupwise sparsity and coefficientwise sparsity. This is done by combining the group lasso penalty with the traditional lasso penalty. In this library, I have implemented an efficient sparse group lasso solver being fully scikitlearn API compliant.
About this project
This project is developed by Yngve Mardal Moe and released under an MIT lisence. I am still working out a few things so changes might come rapidly.
Installation guide
Grouplasso requires Python 3.5+, numpy and scikitlearn. To install grouplasso via pip, simply run the command:
pip install grouplasso
Alternatively, you can manually pull this repository and run the setup.py file:
git clone https://github.com/yngvem/grouplasso.git cd grouplasso python setup.py
Documentation
You can read the full documentation on readthedocs.
Examples
There are several examples that show usage of the library here.
Further work
 Fully test with sparse arrays and make examples
 Make it easier to work with categorical data
 Poisson regression
Implementation details
The problem is solved using the FISTA optimiser [3] with a gradientbased adaptive restarting scheme [4]. No line search is currently implemented, but I hope to look at that later.
Although fast, the FISTA optimiser does not achieve as low loss values as the significantly slower second order interior point methods. This might, at first glance, seem like a problem. However, it does recover the sparsity patterns of the data, which can be used to train a new model with the given subset of the features.
Also, even though the FISTA optimiser is not meant for stochastic optimisation, it has to my experience not suffered a large fall in performance when the mini batch was large enough. I have therefore implemented minibatch optimisation using FISTA, and thus been able to fit models based on data with ~500 columns and 10 000 000 rows on my moderately priced laptop.
Finally, we note that since FISTA uses Nesterov acceleration, is not a descent algorithm. We can therefore not expect the loss to decrease monotonically.
References
[1]  Yuan, M. and Lin, Y. (2006), Model selection and estimation in regression with grouped variables. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68: 4967. doi:10.1111/j.14679868.2005.00532.x 
[2]  Simon, N., Friedman, J., Hastie, T., & Tibshirani, R. (2013). A sparsegroup lasso. Journal of Computational and Graphical Statistics, 22(2), 231245. 
[3]  Beck, A. and Teboulle, M. (2009), A Fast Iterative ShrinkageThresholding Algorithm for Linear Inverse Problems. SIAM Journal on Imaging Sciences 2009 2:1, 183202. doi:10.1137/080716542 
[4]  O’Donoghue, B. & Candès, E. (2015), Adaptive Restart for Accelerated Gradient Schemes. Found Comput Math 15: 715. doi:10.1007/s102080139150 
Project details
Release history Release notifications  RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size  File type  Python version  Upload date  Hashes 

Filename, size group_lasso1.3.0py3noneany.whl (14.0 kB)  File type Wheel  Python version py3  Upload date  Hashes View 
Filename, size grouplasso1.3.0.tar.gz (597.9 kB)  File type Source  Python version None  Upload date  Hashes View 
Hashes for group_lasso1.3.0py3noneany.whl
Algorithm  Hash digest  

SHA256  dda900c4c4a82ffe89f0aaff754e8b8fdf7ba580756afc687a73722c5bbf0010 

MD5  04d228c11597ae82a02468f09588dc5b 

BLAKE2256  5ec7c8bd3b11d7e4c32b0933d06f0e25f24cb5e741df37935b364fa9fc595533 