Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save predictioniogists/6590888 to your computer and use it in GitHub Desktop.
Save predictioniogists/6590888 to your computer and use it in GitHub Desktop.
# 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