lyst / lightfm

A Python implementation of LightFM, a hybrid recommendation algorithm.
Apache License 2.0
4.66k stars 679 forks source link

Auc evalutation return always nan #702

Open apujol-accenture opened 8 months ago

apujol-accenture commented 8 months ago

Hello,

I have an issue when i compute roc auc, ti's return always NAN for all the value in the matrix. `interactions=interactions.tocsr().astype(np.float32) user_features=interactions.tocsr().astype(np.float32) item_features=interactions.tocsr().astype(np.float32)

train, test = random_train_test_split(interactions, test_percentage=0.2, random_state=42)

epochs = 30

# Train model
model = LightFM(loss='bpr', no_components=200, max_sampled=100, learning_schedule='adagrad', item_alpha=1e-6, learning_rate=0.001)

for epoch in range(epochs):
    model.fit_partial(train, user_features=user_features, item_features=item_features, num_threads=3, epochs=1)
    print(auc_score(model, test, train_interactions = train, user_features=user_features, item_features=item_features, check_intersections=True).mean())`

I check the train and test matrix there is no Null or Nan so I don't understand. Can you help me on this case.