alexeygrigorev/libffm-python

NAN prediction

dannyFung opened this issue · 1 comments

When I used it for classification, my prediction is all nan values.

model = ffm.FFM(eta=0.1, lam=0.0001, k=4)
model.init_model(ffm_train_data)
for i in range(n_iter):
    print('iteration %d, ' % i, end='')
    model.iteration(ffm_train_data)
    train_y_pred = model.predict(ffm_train_data)
    print(train_y_pred.shape)
    print(train_y_pred)
    train_auc = roc_auc_score(np.array(train_y_class), train_y_pred)
    test_y_pred = model.predict(ffm_test_data)
    test_auc = roc_auc_score(np.array(test_y_class), test_y_pred)
    print('train auc %.4f' % train_auc,'test auc %.4f' % test_auc)
[nan nan nan ... nan nan nan]

I've no idea why this happen, I can only change the ffm.FFM() function parameters of eta, lam and k. Any idea or suggestion?

check #5 and #6 - I think you need to do some normalization before training the model