Last active
December 23, 2015 23:09
-
-
Save predictioniogists/6708196 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
import io.prediction.ItemSimGetTopNRequestBuilder; | |
// You need to specify the name of the engine from which you want to retrieve the prediction results. | |
// Add the following code to display similar sightseeing spots to the user after arriving a destination: | |
String[] destinationIds; | |
try { | |
//retreive top 5 similar sightseeing spots from the item similarity engine | |
String[] itypes = {"sightseeing"} | |
ItemSimGetTopNRequestBuilder builder = client.getItemSimGetTopNRequestBuilder("the engine name", "arrived destination id", 5) | |
.itypes(itypes); | |
destinationIds = client.getItemSimTopN(builder); | |
} catch (Exception e) { // exception is raised when there is no prediction result. | |
destinationIds = getDefaultSightSeeingSpots(5); // eg. get nearest 5 sightseeing spots | |
handleException(e); | |
} | |
displaySightSeeingSpots(destinationIds); // display similar sightseeing spots to the user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment