LibFM is library for factorization machines using an approach proposed by Steffen Rendle. However it seems that there is no python wrapper for this famous library.

So if you’re looking for python version of LibFM, take a closer look at these projects:

  • https://github.com/coreylynch/pyFM

    Lovely minimalistic implementation of Factorization Machines using cython (previous version used numpy).
    This library has an interface similar to scikit-learn.

    Unfortunately, in my tests I wasn't able to get useful results with this library, while official LibFM was working fine. With learning rate > $1^{-6}$ the learning process simply diverged.

  • http://ibayer.github.io/fastFM/index.html
    fastFM is another option. Library supports both classification and regression.
    Contains three different solvers (SGD, ALS, MCMC). ALS = alternative least squares.
    In the paper written by author of algorithm, he argues that other algorithms are comparable to SGD.

    This library is completely following scikit-learn interface (even deriving from BaseEstimator and appropriate mixin classes), another strong side is that it reimplements all official methods. In the paper written about the library It was stated that this implementation is 2-3 times faster.

  • I was also looking for code in theano, but the only code I found was very dirty and minimalistic (so I’m not hoping it is usable)
    https://github.com/instagibbs/FactorizationMachine
    Update (21 April 2017):
    There is a theano-based implementation by Daniel Steinberg which uses adaptive SGD methods:
    https://github.com/dstein64/PyFactorizationMachines (I haven't tested it).
Update: I've tested some LibFM implementations on several datasets. I've compared libFM and options proposed in this post.