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: https://github.com/adamlauretig/ny_r_talk. 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 (https://www.cs.helsinki.fi/u/sakaya/tutorial/#mtf). This approach is somewhat slow, however, so you’d want to use something like the Anova kernel for the factorization, as implemented here(https://github.com/scikit-learn-contrib/polylearn/blob/master/polylearn/kernels.py#L68).
An alternate approach is using exponential machines, available in python (https://github.com/Bihaqo/t3f), which rely on the tensor-train decomposition, but which are not yet available in stan.