fastFM icon indicating copy to clipboard operation
fastFM copied to clipboard

Assertion failed when fitting with l2_reg_w=0 l2_reg_V=0

Open merrellb opened this issue 9 years ago • 3 comments

When fitting als.FMRegression with l2_reg_w=0 or l2_reg_V=0 I get the following assertion failure:

Assertion failed: (isfinite(new_V_fl) && "V not finite"), function sparse_fit, file ffm_als_mcmc.c, line 218.
Abort trap: 6

I note that older documentation actually has these as defaults but current values are 0.1. Regardless is this expected to fail? I am using pretty basic Movielens training data (ml1m)

5 1:1 11193:1
3 1:1 10661:1
3 1:1 10914:1
4 1:1 13408:1
5 1:1 12355:1
3 1:1 11197:1
5 1:1 11287:1
5 1:1 12804:1
4 1:1 10594:1
4 1:1 10919:1
5 1:1 10595:1
4 1:1 10938:1

merrellb avatar Jan 26 '16 07:01 merrellb

There are a few situations where this is expected. For example if you have a feature that's zero for all examples. One could add input checks for this situations or just always use some regularization (could be very small). Maybe adding a warning that using FM without regularization is not recommenced would be sensible way to deal with this issue. I think that regularization is (nearly) always necessary for good performance.

ibayer avatar Jan 26 '16 07:01 ibayer

I agree it may not be a great idea but given that it seems to be failing at an assertion I wondered if it might be possible to do it more gracefully (or less cryptically). Sorting out the cause is particularly challenging given that these values are given in one of the website examples where the cause isn't as clear as tuning parameters one by one.

http://ibayer.github.io/fastFM/guide.html#how-to-choose-the-right-solver

merrellb avatar Jan 26 '16 08:01 merrellb

The assertion is in the C code which makes error handling quite a bit difficult. I also don't like that the assert crashes python and am open to suggestions on how to do this better (best with PR :smile: ). Thanks for pointing out the example, this definitely needs to be fixed #34

ibayer avatar Jan 26 '16 09:01 ibayer