Release of spm-image : Python library for sparse modeling

Release Of Spm-image : Python Library For Sparse Modeling
We’ve released spm-image, Python library for sparse modeling and compressive sensing, in our GitHub. Its latest version includes k-SVD, which is one of popular dictionary learning algorithms, ADMM implementation of Lasso and ZCA whitening for preprocessing. We’ve created example notebooks as well so that you can get to know how to use this library.The basic concept of this library is as follows

  • Implements sparse modeling and compressive sensing algorithms
  • Depends on scikit-learn only
  • Compliant with module and interface structure of scikit-learn as much as possible

First of all, we have sincere motivation to make common library for sparse modeling since we have been implementing several algorithms like mentioned above for our client projects one by one. We also noticed that sparse modeling itself is not well known among developers while data scientists or academic persons have been focusing it for years. We, as a tech startup, felt that we should broaden this fascinating idea to software developers and decided to make the library for sparse modeling as open source.

As seen in the second and third part of the concept, we have strong obsession to follow scikit-learn since we are heavy user of scikit-learn and love using it.  We’d like such scikit-learn users like us to try our library pretty easily by

  • adding just one dependency to their projects
  • changing import and class name notation to switch algorithm they’re using

Let’s say you have Lasso implementation as follows.

from sklearn.linear_model import Lasso
model = Lasso(alpha=0.1), Y_train)
model.score(X_test, y_test)

To use ADMM implementation, you just need to change the first 2 lines like this.

from spmimage.linear_model import LassoADMM
model = LassoADMM(alpha=0.1), Y_train)
model.score(X_test, y_test)

Pretty easy to switch algorithm by scikit-learn compatible interface.

Though scikit-learn is widely used and very stable, we think there’s still room where we can contribute by implementing cutting edge algorithm with scikit-learn interface as shown above.

We tried to make other common library for sparse modeling before but failed since we didn’t clarify its basic concept and as a result, it became messy and hard to maintain. This time, as a second challenge, we’ll make spm-image tiny but useful library based on the basic concept.

We’re very welcome and open to your feedback. Please join us on our GitHub !

About Hacarus

・Hacarus Inc.
・We’re HIRING!

Category: Machine LearningPython

Takashi Someda

CTO of Hacarus. Has over 15 years experience as a software and server engineer in several global SaaS startups. Currently working hard to make something new with machine learning. Holds masters degree in Information Science at Kyoto University.

Subscribe to our newsletter

Click here to sign up