Last active
December 22, 2015 18:59
-
-
Save predictioniogists/6516857 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. | |
# Add the following code to display the recommended courses to the user after the user has logged in: | |
try: | |
# Retrieve top 5 recommnded courses from the item recommendation engine. | |
# Assuming client.identify("user id") is already called when the user logged in. | |
result = client.get_itemrec_topn("the engine name", 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