lyst / lightfm

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

recommendations for cold start users when model trained without user_features? #645

Open zahraegh opened 2 years ago

zahraegh commented 2 years ago

Due to the getting the same recommendations for almost all users, I trained the model without user_features as was suggested in here (~90 unique items are recommended). The model training is like so:

model = LightFM(no_components= embedding_dimension, learning_rate=0.01, loss='bpr',
               learning_schedule = 'adadelta', random_state=seed)
model.fit(train_interactions,
          epochs=NUM_EPOCHS,
          num_threads=20, 
          verbose=True)

During the inference, for the cold and existing customers, I did the following as was suggested here:

if not cold_start_user_flg:
     scores = model.predict(user_ids=user_id_map[user_id], 
                            item_ids=np.arange(n_items),
                           num_threads=20
                           )
 else:
     scores = model.predict(user_ids=0,
                            item_ids=np.arange(n_items),
                            user_features=user_feature_cold_start,
                            num_threads=20
                           )

My question is since the model got trained without user_features, how is it even able to provide recommendations for cold-start users?

Beytab commented 2 years ago

You can not predict for cold-start users without nothing about user_features. ref:https://stackoverflow.com/questions/46924119/lightfm-handling-user-and-item-cold-start