LightFM rerecommending items
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 724
- PR merge metrics
- No merged PRs in 30d
Description
I am implementing a recommender system (python 3.9) for an online supermarket (hence users can re-order products). All the data is in the correct format which led to an interaction matrix, a weights matrix (to show the importance of some of the interactions), user features and item features.
To make sure I don't get the warning 'Test interactions matrix and train interactions matrix share .. interactions', I have excluded all the interactions from the test set. So if a user buys bananas every week, in the test set we don't have an interaction for bananas. However, we only use this for evaluating, so this should not have anything to do with the predictions.
Aside from the similar products, I was also wondering if LightFM can recommend previously bought items.
```
dataset = Dataset()
dataset.fit(
user_ids_train_dict.keys(), # all the users
item_ids_train_dict.keys(), # all the items
item_features = item_features, # additional item features
user_features = user_features # additional user features
)
model.fit(
interaction_matrix_train,
epochs=100,
user_features=user_features,
item_features=item_features,
sample_weight = weights_matrix_train,
num_threads=2,
verbose = True
)
# interaction matrix that only shows the items that weren't bought before
interaction_matrix_val_new = interaction_matrix_val - interaction_matrix_train
interaction_matrix_val_new[interaction_matrix_val_new < 0 ] = 0
evaluator.evaluate(
epochs,
model,
interaction_matrix_train,
interaction_matrix_val_new,
user_features,
item_features)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Dataset setup, model.fit call, and evaluator.evaluate invocation shown in the issue, then trace how training and validation interaction matrices are consumed. Determine whether previously bought items can be recommended and whether the validation subtraction changes evaluation or prediction behavior; done means the expected behavior and any required project change are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100