Last active
December 23, 2015 05:59
-
-
Save predictioniogists/6590888 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You need to specify the name of the engine from which you want to retrieve the prediction results. | |
# When a user views a meal, you can suggest similar meals to the user by adding the following: | |
begin | |
# retreive top 5 similar courses from the item similarity engine | |
iids = client.get_itemsim_top_n("the engine name", "the viewed meal ID", 5) # list of recommended meal IDs | |
rescue ItemSimNotFoundError => e | |
iids = get_default_iids_list(5) # default behavior when there is no prediction results, e.g. recommends newest meals | |
log_error(e) # log the error for debugging or analysis later | |
end | |
display_meals(iids) # display meals to the user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment