← all repositories
ibayer/fastFM

Factorization Machines for people who just want `fit()` and `predict()`

A scikit-learn-compatible wrapper around C solvers for factorization machines, born from an academic citation-counting incentive structure.

1.1k stars Python ML Frameworks
fastFM
Velocity · 7d
+0.3
★ / day
Trend
steady
star history

What it does

fastFM exposes factorization machines—models that capture feature interactions for recommendation, regression, and classification—through a familiar scikit-learn API. The heavy lifting happens in C, wrapped with Cython, so you call als.FMRegression(...).fit(X, y) from Python 2.7 or 3.x and get predictions back without managing the linear algebra yourself.

The interesting bit

The library bundles three optimization philosophies under one interface: stochastic gradient descent, coordinate descent, and MCMC for Bayesian inference. That’s unusual—most libraries pick one and call it done. The MCMC option in particular lets you get uncertainty estimates, not just point predictions, though you’ll pay in compute.

Key highlights

  • scikit-learn-compatible estimators for regression, classification, and ranking (via BPR loss)
  • Solvers: ALS, SGD, and MCMC with Probit/Sigmoid/Map variants for classification
  • Performance-critical code in C with Cython bindings; pip-installable binary for 64-bit Linux/OSX
  • Published in JMLR (2016) with an explicit “please cite us” mandate from the author
  • Core C library available as standalone CLI via subrepository

Caveats

  • CI only covers Ubuntu 14.04 LTS and OS X Mavericks; other platforms explicitly not supported
  • Source install requires matching Python/OS bitness and manual BLAS headers (libopenblas-dev or libatlas-base-dev)
  • Uses nose for tests, which is itself deprecated

Verdict

Worth a look if you’re doing research on factorization machines and need a reference implementation with multiple solvers to compare. Skip it if you want active maintenance, modern Python packaging, or Windows support—this is an academic artifact that happens to run code well.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.