LightFM
The LightFM handler functions as an interface for the LightFM Python recommendation library. The current implementation supports collaborative filtering for user-item and item-item recommendations. It allows users to make use of the powerful LightFM recommendation framework library for performing recommendation on interaction data sets.
As the current implementations stand, the input data should be a table containing user-item interaction data:
Please note that at the moment this integrations does not support the FINETUNE
feature.
Example
Before creating a LightFM model, we need to create an ML engine.
You can verify it by running SHOW ML_ENGINES
.
Now let’s create a LightFM model specifying the necessary input parameters.
The required parameters include the following:
- The
item_id
parameter that stores items to be recommended; here, these are movies. - The
user_id
parameter that stores users to whom items are recommended. - The
threshold
parameter is used when score of interaction is provided in the input data. It defines the threshold for the recommendation. - The
n_recommendations
parameter stores the number of recommendations to be returned.
Optionally, you can provide the evaluation
parameter if you want to store the evaluation metrics. It is set to false
by default.
Here is how to connect the mysql_demo_db
used for training the model:
Let’s query for the following recommendations:
-
Get recommendations for all item_item pairs:
-
Get item-item recommendations for a specific item_id:
-
Get recommendations for all user-item pairs:
-
Get user-item recommendations for a specific user_id:
-
Get user-item recommendations for multiple user_ids: