ibayer / fastFM

fastFM: A Library for Factorization Machines
http://ibayer.github.io/fastFM
Other
1.07k stars 206 forks source link

Get rid of C assertions please #91

Open quantverse opened 7 years ago

quantverse commented 7 years ago

Hello,

this project should just get rid of C assertions completely (they should be replaced by some better, reliable error handling techniques.) I use this library from python and it crashes whole script when assertion fails.

Example: when it does not like something in your data (whatever that is), it just crashes with assertion like this:

python3: ffm_als_mcmc.c:172: sparse_fit: Assertion `(sizeof (*w_0) == sizeof (float) ? __finitef (*w_0) : sizeof (*w_0) == sizeof (double) ? __finite (*w_0) : __finitel (*w_0)) && "w_0 not finite"' failed.

Which crashes the python script completely without any possibility to recover from the error. This should never happen. It should throw an exception instead so the script may recover if it catches the exception. Until then, fastFM cannot be used in any automated complex applications.

ibayer commented 7 years ago

Thank you for your kind words. A contributions removing the assertions would indeed be very welcome. A good place to start would be this issue: https://github.com/ibayer/fastFM/issues/88