pywFM
pywFM copied to clipboard
Global bias is None, even k0 is True
I was trying to calculate the prediction value myself with the weight output by model and always got the wrong answer. Then I realized that the bias value is always None, even if I set k0=True manually.
fm = pywFM.FM(task='regression', num_iter=5, k2=2, k0=True)
I don't know whether the wrong answer came from the absence of bias, but it seems strange that the global_bias is always None.
How can I fix it? Or, is there any possibility I can calculate the prediction myself?
Could you provide a MWE?
Thank you for the report!
I had the same issue, with both regression and classification. Below is an MWE. (I followed the installation for libfm, and installed the latest pywFM with https://github.com/jfloff/pywFM/issues/29#issuecomment-663429991)
import numpy as np
import pywFM
x = np.array([
[0., 1.],
[1., 0.],
])
y = np.array([-1., 1.])
fm = pywFM.FM("regression", num_iter=10, k0=True, seed=1)
model = fm.run(x, y, x, y) # using the same data for simplicity
print(model.predictions, model.global_bias)
# output: [-0.429961, 0.264456] None
Not sure if the issue is due to temp files. Thanks in advance!