Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global bias is None, even k0 is True #25

Open
snowsteper opened this issue Feb 11, 2018 · 2 comments
Open

Global bias is None, even k0 is True #25

snowsteper opened this issue Feb 11, 2018 · 2 comments

Comments

@snowsteper
Copy link

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?

@jfloff
Copy link
Owner

jfloff commented Feb 13, 2018

Could you provide a MWE?

Thank you for the report!

@kevin1kevin1k
Copy link

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 #29 (comment))

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants