Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save predictioniogists/6504058 to your computer and use it in GitHub Desktop.
Save predictioniogists/6504058 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 any user views a course, you can suggest similar courses to the user by adding the following:
try:
# retreive top 5 similar courses from the item similarity engine
result = client.get_itemsim_topn("the engine name", "the viewed course ID", 5)
iids = result['pio_iids'] # list of recommended course IDs
except Exception as e:
iids = get_default_iids_list(5) # default behavior when no prediction results. eg. recommends latest courses
log_error(e) # log the error for debugging or analysis later
display_courses(iids) # display the courses to the user
@gianpaj
Copy link

gianpaj commented Oct 28, 2013

retrieve -> retreive
behavior -> behaviour
:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment