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

fm.predict gives nan values #126

Open
chrisbangun opened this issue Nov 28, 2017 · 3 comments
Open

fm.predict gives nan values #126

chrisbangun opened this issue Nov 28, 2017 · 3 comments

Comments

@chrisbangun
Copy link

chrisbangun commented Nov 28, 2017

Hi,

I follow the step-by-step provided in the test_ranking.py in order to use fastFM for ranking problem. Using my own dataset, the model returns nan prediction value.

fm = bpr.FMRecommender(n_iter=2000,
                           init_stdev=0.01, l2_reg_w=.5, l2_reg_V=.5, rank=2,
                           step_size=.002, random_state=11)

fm.fit(x_train_sp_matrix,compares)

y_pred = fm.predict(X_test)

the X_test is simply the copy of my training data.
what would be the case where fm model returns nan? any help would really be appreciated. thanks

@todor-markov
Copy link

I have the same problem but with sgd.FMClassification

@yushcs
Copy link

yushcs commented Jun 11, 2018

Is there anyone know how to solve it?

@ibayer
Copy link
Owner

ibayer commented Jun 11, 2018

Unfortunately many issues can lead to nan predictions.

  • Make sure you model inputs are sound.
  • If the predictions are nan check if the model parameter are nan too.
  • Both bpr.FMRecommender and sgd.FMClassification use stochastic gradient based solvers for the parameter estimation (fit). This means they are sensitive to the step_size and initial values init_stdev hyper-parameter. Getting this values wrong can often lead to 'nan' predictions.
  • The bpr implementation is not very robust and should currently only be used for small scale experiments.

@todor-markov I would recomment to use use the als/mcmc solver instead.

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

4 participants