fastFM
fastFM copied to clipboard
Support dense matrices or convert to sparse instead of raising TypeError
When I try to fit als.FMClassifier with a dense numpy matrix, I get:
File "/home/mack/anaconda2/lib/python2.7/site-packages/fastFM/als.py", line 175, in fit
order="F")
File "/home/mack/anaconda2/lib/python2.7/site-packages/fastFM/validation.py", line 29, in wrapper
raise TypeError('A dense matrix was passed in, but sparse'
TypeError: A dense matrix was passed in, but sparsedata is required.
Any reason not to support dense matrices? I'm wondering if it's simply because the type of data an FM is well-suited for cannot generally be represented by a dense matrix. Seems like if the user can fit it into memory, then why not support it? If sparse matrices are absolutely required, is it reasonable to simply convert to a dense matrix instead of raising the TypeError?
FMs can deal with dense matrices but I wouldn’t expect better performance then a straight forward second order polynomial regression/classification.
The fastFM solver are optimized for sparse matrices, converting a dense matrix is conceivable but only if we raise a warning. I consider the use of dense matrices with FMs an edge case and the user should be aware of this.