Skip to content

getspams/spams-R

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPAMS: a SPArse Modeling Software

Here is the R package interfacing the SPAMS C++ library.

What is SPAMS?

SPAMS (SPArse Modeling Software) is an optimization toolbox for solving various sparse estimation problems.

  • Dictionary learning and matrix factorization (NMF, sparse PCA, ...)
  • Solving sparse decomposition problems with LARS, coordinate descent, OMP, SOMP, proximal methods
  • Solving structured sparse decomposition problems (l1/l2, l1/linf, sparse group lasso, tree-structured regularization, structured sparsity with overlapping groups, ...)

Installation

Requirements:

  • a C++ modern compiler (tested with gcc >= 4.5)
  • a BLAS/LAPACK library (like OpenBLAS, Intel MKL, Atlas)

To install SPAMS on R, you can use the remotes or devtools package and run from R:

library(remotes) # or library(devtools)
install_github("getspams/spams-R")

You can also download the sources from the SPAMS R package git repository and locally install the package from source.

DISCLAIMER: installation and functioning of SPAMS R package from here was only tested on GNU/Linux OS.

SPAMS R package is also available on the official website, please check the dedicated section and corresponding instructions in the official documentation.


Links

SPAMS-related git repositories are also available on Inria gitlab forge: see original C++ project (and original sources for Matlab, Python and R interfaces), Python specific project

Contact

Regarding SPAMS Python package: you can open an issue on the dedicated git project at https://github.com/getspams/spams-python

Regarding SPAMS R package: you can open an issue on the dedicated git project at https://github.com/getspams/spams-R

For any other question related to the use or development of SPAMS:


Authorship

SPAMS is developed and maintained by Julien Mairal (Inria), and contains sparse estimation methods resulting from collaborations with various people: notably, Francis Bach, Jean Ponce, Guillermo Sapiro, Rodolphe Jenatton and Guillaume Obozinski.

It is coded in C++ with a Matlab interface. Interfaces for R and Python have been developed by Jean-Paul Chieze, and archetypal analysis was written by Yuansi Chen.

Release of version 2.6/2.6.1 and porting to R-3.x and Python3.x was done by Ghislain Durif (Inria). The original porting to Python3.x is based on this patch and on the work of John Kirkham available here.

Version 2.6.2 (Python only) update is based on contributions by Francois Rheault and Samuel Saint-Jean.

Maintenance

Since version 2.6.3+, SPAMS (especially the Python version) is now maintained by the following team:


Funding

This work was supported in part by the SIERRA and VIDEOWORLD ERC projects, and by the MACARON ANR project.

License

Version 2.1 and later are open-source under GPLv3 licence. For other licenses, please contact the authors.


News

  • 14/02/2022: Python SPAMS is now officially hosted on Github
  • 07/02/2022: SPAMS C++ project and SPAMS for R are now officially hosted on Github
  • 03/02/2022: Python SPAMS v2.6.3 is released (source and PyPI)
  • 03/09/2020: Python SPAMS v2.6.2 is released (source and PyPI)
  • 15/01/2019: Python SPAMS v2.6.1 is available on PyPI)
  • 08/12/2017: Python SPAMS v2.6.1 for Anaconda (with MKL support) is released
  • 24/08/2017: Python SPAMS v2.6.1 is released (a single source code for Python 3 and 2)
  • 27/02/2017: SPAMS v2.6 is released, including precompiled Matlab packages, R-3.x and Python3.x compatibility
  • 25/05/2014: SPAMS v2.5 is released
  • 12/05/2013: SPAMS v2.4 is released
  • 05/23/2012: SPAMS v2.3 is released
  • 03/24/2012: SPAMS v2.2 is released with a Python and R interface, and new compilation scripts for a better Windows/Mac OS compatibility
  • 06/30/2011: SPAMS v2.1 goes open-source!
  • 11/04/2010: SPAMS v2.0 is out for Linux and Mac OS!
  • 02/23/2010: Windows 32 bits version available! Elastic-Net is implemented
  • 10/26/2009: Mac OS, 64 bits version available!

Note for users

SPAMS is now available in version 2.6

Python users

Python users can install SPAMS from PyPI by using pip install spams.

Developpers that would like to regenerate the entire Python interface and documentation can check the dedicated folder swig where an interface with some instructions is available.

R users

R users can download the sources of the R SPAMS package from the official website and install it from source.

Developpers that would like to regenerate the entire R interface and documentation can check the dedicated folder swig where an interface with some instructions is available.

Matlab users

Precompiled toolbox

You can use the precompiled toolbox spams-matlab-precompiled-v2.6-%LAST_DATE%-%OS%.tar.gz for Linux or MacOS. You extract the tarball and run Matlab in the current directory. You have to use the command start_spams in Matlab to load the precompiled functions. HOW_TO_USE.txt for details.

The precompiled version for MacOS was compiled on MacOS X Maverick (10.9.5), please let us know if you encounter any issues on more recent MacOS version.

At the moment, no precompiled version is available for Windows users, we are currently working on it.

DISCLAIMER

In the MacOS precompiled version, the multi-threading with OpenMP is not available (not supported by the compiler clang at the moment).

To enable multi-threading, you will have to compile the library (c.f. below) with a different compiler (e.g. gcc, intel or clang-omp).

Building the library (more advanced users)

The best way to compile the library is to open the file compile.m and follow instructions. You can modify the beginning of the file to choose the compiler, the blas library, set some options and the different paths, then run compile.m in Matlab.

After all the mex-files are compiled, a script run_matlab.sh is also created, at least for the Linux and/or Mac OS version. Depending on your configuration, it might be necessary to launch Matlab with the script in order to use the toolbox (in order to preload multi-threading libraries). Otherwise, just type "start_spams;" and use the SPAMS library.


References

A monograph about sparse estimation

We encourage the users of SPAMS to read the following monograph, which contains numerous applications of dictionary learning, an introduction to sparse modeling, and many practical advices.

Related publications

You can find here some publications at the origin of this software.

The "matrix factorization" and "sparse decomposition" modules were developed for the following papers:

The "proximal" module was developed for the following papers:

The feature selection tools for graphs were developed for:

The incremental and stochastic proximal gradient algorithm correspond to the following papers: