Last active
December 22, 2015 17:09
-
-
Save predictioniogists/6504058 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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
retrieve -> retreive
behavior -> behaviour
:)