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
let eventClient = EventClient(accessKey: accessKey, baseURL: "http://localhost:7070") | |
let event = Event( | |
event: "view", | |
entityType: "user", | |
entityID: "16398de4-cd17-11e4-afdc-1681e6b88ec1", | |
targetEntityType: "item", | |
targetEntityID: "2274f58a-cd17-11e4-afdc-1681e6b88ec1" | |
) | |
eventClient.createEvent(event) { (request, response, JSON, error) in |
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
{ | |
"systeminfos": { | |
"version": { | |
"value": "0.6.8", | |
"description": "PredictionIO version" | |
}, | |
"jars.pdioItemrecAlgo": { | |
"value": "predictionio-process-hadoop-scalding-assembly-0.6.8.jar" | |
}, | |
"jars.pdioItemsimAlgo": { |
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 provide personalized recommendation to the user after the user has logged in: | |
try: | |
# Retrieve top 10 recommnded projects from the item recommendation engine. | |
# Assuming client.identify("user id") is already called when the user logged in. | |
result = client.get_itemrec_topn("itemrec engine name", 10) | |
iids = result['pio_iids'] # list of recommended project IDs | |
except Exception as e: | |
iids = get_default_iids_list(10) # default behavior when no prediction results. eg. recommends the latest created projects |
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. | |
# Suggest similar viewed projects | |
try: | |
# retreive top 5 similar viewed projects | |
result = client.get_itemsim_topn("itemsim-view", "the project ID", 5) | |
iids = result['pio_iids'] # list of recommended project IDs | |
except Exception as e: | |
iids = get_default_iids_list(5) # default behavior when no prediction results. eg. recommends the latest viewed projects | |
log_error(e) # Handle error here. You may log the error for debugging. | |
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. | |
# Suggest similar funded projects | |
try: | |
# retreive top 5 similar funded projects | |
result = client.get_itemsim_topn("itemsim-fund", "the project ID", 5) | |
iids = result['pio_iids'] # list of recommended project IDs | |
except Exception as e: | |
iids = get_default_iids_list(5) # default behavior when no prediction results. eg. recommends the latest funded projects | |
log_error(e) # Handle error here. You may log the error for debugging. | |
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 predictionio | |
# In the beginning of your application, you need to instantiate the PredictionIO client object. | |
# You need this client object to import data into PredictionIO and retrieve prediction results. | |
# Add this line to the place where you do initialization: | |
cient = predictionio.Client("your App Key") | |
# Then add the following lines to your codes which handle the corresponding application logic: | |
# When a new user registers: |
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
php composer.phar install |
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
curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off |
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
{ | |
"require": { | |
"predictionio/predictionio": "~0.6.0" | |
} | |
} |
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
<?php | |
// Use Composer's autoloader to load PredictionIO PHP SDK. | |
require_once("vendor/autoload.php"); | |
use PredictionIO\PredictionIOClient; | |
// In the beginning of your application, you need to instantiate the PredictionIO client object. | |
// You need this client object to import data into PredictionIO and retrieve prediction results. | |
// Add this line to the place where you do initialization: | |
$client = PredictionIOClient::factory(array("appkey" => "your app key")); |