Presentation on Stan and Factorization Machines

Hi Everyone!

Long-time, first-time. I recently gave a talk to the NY R users meetup on factorization machines in stan/rstan. I thought the slides/code might be of interest to folks here. Here’s the repo: I hope these are interesting and helpful!


Thanks for sharing! For > 2 way interactions is the Stan code amenable (in the naive way) to just adding the next interaction level and coefficients? Or is it more involved?

Great question! As I understand it, it’s a little more involved, as now, rather than a matrix decomposition, you’d need to perform a tensor decomposition. Since this method doesn’t currently exist in stan, you’d have to roll your own, a la ( This approach is somewhat slow, however, so you’d want to use something like the Anova kernel for the factorization, as implemented here(

An alternate approach is using exponential machines, available in python (, which rely on the tensor-train decomposition, but which are not yet available in stan.