You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by do...@apache.org on 2016/10/03 17:22:55 UTC
[02/15] incubator-predictionio-site git commit: Based on
apache/incubator-predictionio#2f196dab3d4f603a7f720bb605d9f630599f0b5f
http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/f6e7c2b4/templates/similarproduct/quickstart/index.html
----------------------------------------------------------------------
diff --git a/templates/similarproduct/quickstart/index.html b/templates/similarproduct/quickstart/index.html
index 2062564..8c4ed9c 100644
--- a/templates/similarproduct/quickstart/index.html
+++ b/templates/similarproduct/quickstart/index.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html><html><head><title>Quick Start - Similar Product Engine Template</title><meta charset="utf-8"/><meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta class="swiftype" name="title" data-type="string" content="Quick Start - Similar Product Engine Template"/><link rel="canonical" href="https://docs.prediction.io/templates/similarproduct/quickstart/"/><link href="/images/favicon/normal-b330020a.png" rel="shortcut icon"/><link href="/images/favicon/apple-c0febcf2.png" rel="apple-touch-icon"/><link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet"/><link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/><link href="/stylesheets/application-a2a2f408.css" rel="stylesheet" type="text/css"/><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.mi
n.js"></script><script src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><script src="//use.typekit.net/pqo0itb.js"></script><script>try{Typekit.load({ async: true });}catch(e){}</script></head><body><div id="global"><header><div class="container" id="header-wrapper"><div class="row"><div class="col-sm-12"><div id="logo-wrapper"><span id="drawer-toggle"></span><a href="#"></a><a href="http://predictionio.incubator.apache.org/"><img alt="PredictionIO" id="logo" src="/images/logos/logo-ee2b9bb3.png"/></a></div><div id="menu-wrapper"><div id="pill-wrapper"><a class="pill left" href="/gallery/template-gallery">TEMPLATES</a> <a class="pill right" href="//github.com/apache/incubator-predictionio/">OPEN SOURCE</a></div></div><img class="mobile-search-bar-toggler hidden-md hidden-lg" src="/images/icons/search-glass-704bd4ff.png"/></div></div></div></header><div id="search-bar-row-wrapper"><div class="container-fluid" id="search-bar-row"><div class="row"
><div class="col-md-9 col-sm-11 col-xs-11"><div class="hidden-md hidden-lg" id="mobile-page-heading-wrapper"><p>PredictionIO Docs</p><h4>Quick Start - Similar Product Engine Template</h4></div><h4 class="hidden-sm hidden-xs">PredictionIO Docs</h4></div><div class="col-md-3 col-sm-1 col-xs-1 hidden-md hidden-lg"><img id="left-menu-indicator" src="/images/icons/down-arrow-dfe9f7fe.png"/></div><div class="col-md-3 col-sm-12 col-xs-12 swiftype-wrapper"><div class="swiftype"><form class="search-form"><img class="search-box-toggler hidden-xs hidden-sm" src="/images/icons/search-glass-704bd4ff.png"/><div class="search-box"><img src="/images/icons/search-glass-704bd4ff.png"/><input type="text" id="st-search-input" class="st-search-input" placeholder="Search Doc..."/></div><img class="swiftype-row-hider hidden-md hidden-lg" src="/images/icons/drawer-toggle-active-fcbef12a.png"/></form></div></div><div class="mobile-left-menu-toggler hidden-md hidden-lg"></div></div></div></div><div id="page"
class="container-fluid"><div class="row"><div id="left-menu-wrapper" class="col-md-3"><nav id="nav-main"><ul><li class="level-1"><a class="expandible" href="/"><span>Apache PredictionIO (incubating) Documentation</span></a><ul><li class="level-2"><a class="final" href="/"><span>Welcome to Apache PredictionIO (incubating)</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Getting Started</span></a><ul><li class="level-2"><a class="final" href="/start/"><span>A Quick Intro</span></a></li><li class="level-2"><a class="final" href="/install/"><span>Installing Apache PredictionIO (incubating)</span></a></li><li class="level-2"><a class="final" href="/start/download/"><span>Downloading an Engine Template</span></a></li><li class="level-2"><a class="final" href="/start/deploy/"><span>Deploying Your First Engine</span></a></li><li class="level-2"><a class="final" href="/start/customize/"><span>Customizing the Engine</span></a></li></ul></li><li class="level-1
"><a class="expandible" href="#"><span>Integrating with Your App</span></a><ul><li class="level-2"><a class="final" href="/appintegration/"><span>App Integration Overview</span></a></li><li class="level-2"><a class="expandible" href="/sdk/"><span>List of SDKs</span></a><ul><li class="level-3"><a class="final" href="/sdk/java/"><span>Java & Android SDK</span></a></li><li class="level-3"><a class="final" href="/sdk/php/"><span>PHP SDK</span></a></li><li class="level-3"><a class="final" href="/sdk/python/"><span>Python SDK</span></a></li><li class="level-3"><a class="final" href="/sdk/ruby/"><span>Ruby SDK</span></a></li><li class="level-3"><a class="final" href="/sdk/community/"><span>Community Powered SDKs</span></a></li></ul></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Deploying an Engine</span></a><ul><li class="level-2"><a class="final" href="/deploy/"><span>Deploying as a Web Service</span></a></li><li class="level-2"><a class="final" href="/cli/#engine
-commands"><span>Engine Command-line Interface</span></a></li><li class="level-2"><a class="final" href="/deploy/monitoring/"><span>Monitoring Engine</span></a></li><li class="level-2"><a class="final" href="/deploy/engineparams/"><span>Setting Engine Parameters</span></a></li><li class="level-2"><a class="final" href="/deploy/enginevariants/"><span>Deploying Multiple Engine Variants</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Customizing an Engine</span></a><ul><li class="level-2"><a class="final" href="/customize/"><span>Learning DASE</span></a></li><li class="level-2"><a class="final" href="/customize/dase/"><span>Implement DASE</span></a></li><li class="level-2"><a class="final" href="/customize/troubleshooting/"><span>Troubleshooting Engine Development</span></a></li><li class="level-2"><a class="final" href="/api/current/#package"><span>Engine Scala APIs</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Coll
ecting and Analyzing Data</span></a><ul><li class="level-2"><a class="final" href="/datacollection/"><span>Event Server Overview</span></a></li><li class="level-2"><a class="final" href="/cli/#event-server-commands"><span>Event Server Command-line Interface</span></a></li><li class="level-2"><a class="final" href="/datacollection/eventapi/"><span>Collecting Data with REST/SDKs</span></a></li><li class="level-2"><a class="final" href="/datacollection/eventmodel/"><span>Events Modeling</span></a></li><li class="level-2"><a class="final" href="/datacollection/webhooks/"><span>Unifying Multichannel Data with Webhooks</span></a></li><li class="level-2"><a class="final" href="/datacollection/channel/"><span>Channel</span></a></li><li class="level-2"><a class="final" href="/datacollection/batchimport/"><span>Importing Data in Batch</span></a></li><li class="level-2"><a class="final" href="/datacollection/analytics/"><span>Using Analytics Tools</span></a></li></ul></li><li class="level-1"><
a class="expandible" href="#"><span>Choosing an Algorithm(s)</span></a><ul><li class="level-2"><a class="final" href="/algorithm/"><span>Built-in Algorithm Libraries</span></a></li><li class="level-2"><a class="final" href="/algorithm/switch/"><span>Switching to Another Algorithm</span></a></li><li class="level-2"><a class="final" href="/algorithm/multiple/"><span>Combining Multiple Algorithms</span></a></li><li class="level-2"><a class="final" href="/algorithm/custom/"><span>Adding Your Own Algorithms</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>ML Tuning and Evaluation</span></a><ul><li class="level-2"><a class="final" href="/evaluation/"><span>Overview</span></a></li><li class="level-2"><a class="final" href="/evaluation/paramtuning/"><span>Hyperparameter Tuning</span></a></li><li class="level-2"><a class="final" href="/evaluation/evaluationdashboard/"><span>Evaluation Dashboard</span></a></li><li class="level-2"><a class="final" href="/evalua
tion/metricchoose/"><span>Choosing Evaluation Metrics</span></a></li><li class="level-2"><a class="final" href="/evaluation/metricbuild/"><span>Building Evaluation Metrics</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>System Architecture</span></a><ul><li class="level-2"><a class="final" href="/system/"><span>Architecture Overview</span></a></li><li class="level-2"><a class="final" href="/system/anotherdatastore/"><span>Using Another Data Store</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Engine Template Gallery</span></a><ul><li class="level-2"><a class="final" href="/gallery/template-gallery/"><span>Browse</span></a></li><li class="level-2"><a class="final" href="/community/submit-template/"><span>Submit your Engine as a Template</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Demo Tutorials</span></a><ul><li class="level-2"><a class="final" href="/demo/tapster/"><span>Comics
Recommendation Demo</span></a></li><li class="level-2"><a class="final" href="/demo/community/"><span>Community Contributed Demo</span></a></li><li class="level-2"><a class="final" href="/demo/textclassification/"><span>Text Classification Engine Tutorial</span></a></li></ul></li><li class="level-1"><a class="expandible" href="/community/"><span>Getting Involved</span></a><ul><li class="level-2"><a class="final" href="/community/contribute-code/"><span>Contribute Code</span></a></li><li class="level-2"><a class="final" href="/community/contribute-documentation/"><span>Contribute Documentation</span></a></li><li class="level-2"><a class="final" href="/community/contribute-sdk/"><span>Contribute a SDK</span></a></li><li class="level-2"><a class="final" href="/community/contribute-webhook/"><span>Contribute a Webhook</span></a></li><li class="level-2"><a class="final" href="/community/projects/"><span>Community Projects</span></a></li></ul></li><li class="level-1"><a class="expandible
" href="#"><span>Getting Help</span></a><ul><li class="level-2"><a class="final" href="/resources/faq/"><span>FAQs</span></a></li><li class="level-2"><a class="final" href="/support/"><span>Support</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Resources</span></a><ul><li class="level-2"><a class="final" href="/resources/intellij/"><span>Developing Engines with IntelliJ IDEA</span></a></li><li class="level-2"><a class="final" href="/resources/upgrade/"><span>Upgrade Instructions</span></a></li><li class="level-2"><a class="final" href="/resources/glossary/"><span>Glossary</span></a></li></ul></li></ul></nav></div><div class="col-md-9 col-sm-12"><div class="content-header hidden-md hidden-lg"><div id="page-title"><h1>Quick Start - Similar Product Engine Template</h1></div></div><div id="table-of-content-wrapper"><h5>On this page</h5><aside id="table-of-contents"><ul> <li> <a href="#overview">Overview</a> </li> <li> <a href="#usage">Usage</a> </li> <
li> <a href="#1-install-and-run-predictionio">1. Install and Run PredictionIO</a> </li> <li> <a href="#2-create-a-new-engine-from-an-engine-template">2. Create a new Engine from an Engine Template</a> </li> <li> <a href="#3-generate-an-app-id-and-access-key">3. Generate an App ID and Access Key</a> </li> <li> <a href="#4-collecting-data">4. Collecting Data</a> </li> <li> <a href="#5-deploy-the-engine-as-a-service">5. Deploy the Engine as a Service</a> </li> <li> <a href="#6-use-the-engine">6. Use the Engine</a> </li> <li> <a href="#advanced-query">Advanced Query</a> </li> </ul> </aside><hr/><a id="edit-page-link" href="https://github.com/apache/incubator-predictionio/tree/livedoc/docs/manual/source/templates/similarproduct/quickstart.html.md.erb"><img src="/images/icons/edit-pencil-d6c1bb3d.png"/>Edit this page</a></div><div class="content-header hidden-sm hidden-xs"><div id="page-title"><h1>Quick Start - Similar Product Engine Template</h1></div></div><div class="content"><h2 id='o
verview' class='header-anchors'>Overview</h2><p>This engine template recommends products that are "similar" to the input product(s). Similarity is not defined by user or item attributes but by users' previous actions. By default, it uses 'view' action such that product A and B are considered similar if most users who view A also view B. The template can be customized to support other action types such as buy, rate, like..etc.</p><p>This template is ideal for recommending products to customers based on their recent actions. Using the IDs of the recently viewed products of a customer as the <em>Query</em>, the engine will predict other products that this customer may also like.</p><p>This approach works perfectly for customers who are <strong>first-time visitors</strong> or have not signed in. Recommendations are made dynamically in <em>real-time</em> based on the most recent product preference you provide in the <em>Query</em>. You can, therefore, recommend prod
ucts to visitors without knowing a long history about them.</p><p>You can also use this template to build the popular feature of Amazon: <strong>"Customers Who Viewed This Item Also Viewed..."</strong> quickly. Help your customers explore more products that they like, and sell more products.</p><h2 id='usage' class='header-anchors'>Usage</h2><h3 id='event-data-requirements' class='header-anchors'>Event Data Requirements</h3><p>By default, this template takes the following data from Event Server as Training Data:</p> <ul> <li>User <em>$set</em> events</li> <li>Item <em>$set</em> events with <em>categories</em> properties</li> <li>Users' <em>view</em> item events</li> </ul> <div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>buy</em>, <em>rate</em> and <em>like</em>. You can offer features like "Customers Who Bought This Item Also Bought....".</p></div><h3 id='input-query' class='header-anchors'>Inp
ut Query</h3> <ul> <li>List of ItemIDs, which are the targeted products</li> <li>N (number of items to be recommended)</li> <li>List of white-listed item categories (optional)</li> <li>List of white-listed ItemIds (optional)</li> <li>List of black-listed ItemIds (optional)</li> </ul> <p>The template also supports black-list and white-list. If a white-list is provided, the engine will include only those products in the recommendation. Likewise, if a black-list is provided, the engine will exclude those products in the recommendation.</p><h3 id='output-predictedresult' class='header-anchors'>Output PredictedResult</h3> <ul> <li>a ranked list of recommended itemIDs</li> </ul> <h2 id='1.-install-and-run-predictionio' class='header-anchors'>1. Install and Run PredictionIO</h2><p>First you need to <a href="/install">install PredictionIO 0.9.6</a> (if you haven't done it).</p><p>Let's say you have installed PredictionIO at <code>/home/yourname/PredictionIO/</code>. For convenience,
add PredictionIO's binary command path to your <code>PATH</code>, i.e. <code>/home/yourname/PredictionIO/bin</code>:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ </span><span class="nv">PATH</span><span class="o">=</span><span class="nv">$PATH</span>:/home/yourname/PredictionIO/bin; <span class="nb">export </span>PATH
+<!DOCTYPE html><html><head><title>Quick Start - Similar Product Engine Template</title><meta charset="utf-8"/><meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta class="swiftype" name="title" data-type="string" content="Quick Start - Similar Product Engine Template"/><link rel="canonical" href="https://docs.prediction.io/templates/similarproduct/quickstart/"/><link href="/images/favicon/normal-b330020a.png" rel="shortcut icon"/><link href="/images/favicon/apple-c0febcf2.png" rel="apple-touch-icon"/><link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet"/><link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/><link href="/stylesheets/application-a2a2f408.css" rel="stylesheet" type="text/css"/><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.mi
n.js"></script><script src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><script src="//use.typekit.net/pqo0itb.js"></script><script>try{Typekit.load({ async: true });}catch(e){}</script></head><body><div id="global"><header><div class="container" id="header-wrapper"><div class="row"><div class="col-sm-12"><div id="logo-wrapper"><span id="drawer-toggle"></span><a href="#"></a><a href="http://predictionio.incubator.apache.org/"><img alt="PredictionIO" id="logo" src="/images/logos/logo-ee2b9bb3.png"/></a></div><div id="menu-wrapper"><div id="pill-wrapper"><a class="pill left" href="/gallery/template-gallery">TEMPLATES</a> <a class="pill right" href="//github.com/apache/incubator-predictionio/">OPEN SOURCE</a></div></div><img class="mobile-search-bar-toggler hidden-md hidden-lg" src="/images/icons/search-glass-704bd4ff.png"/></div></div></div></header><div id="search-bar-row-wrapper"><div class="container-fluid" id="search-bar-row"><div class="row"
><div class="col-md-9 col-sm-11 col-xs-11"><div class="hidden-md hidden-lg" id="mobile-page-heading-wrapper"><p>PredictionIO Docs</p><h4>Quick Start - Similar Product Engine Template</h4></div><h4 class="hidden-sm hidden-xs">PredictionIO Docs</h4></div><div class="col-md-3 col-sm-1 col-xs-1 hidden-md hidden-lg"><img id="left-menu-indicator" src="/images/icons/down-arrow-dfe9f7fe.png"/></div><div class="col-md-3 col-sm-12 col-xs-12 swiftype-wrapper"><div class="swiftype"><form class="search-form"><img class="search-box-toggler hidden-xs hidden-sm" src="/images/icons/search-glass-704bd4ff.png"/><div class="search-box"><img src="/images/icons/search-glass-704bd4ff.png"/><input type="text" id="st-search-input" class="st-search-input" placeholder="Search Doc..."/></div><img class="swiftype-row-hider hidden-md hidden-lg" src="/images/icons/drawer-toggle-active-fcbef12a.png"/></form></div></div><div class="mobile-left-menu-toggler hidden-md hidden-lg"></div></div></div></div><div id="page"
class="container-fluid"><div class="row"><div id="left-menu-wrapper" class="col-md-3"><nav id="nav-main"><ul><li class="level-1"><a class="expandible" href="/"><span>Apache PredictionIO (incubating) Documentation</span></a><ul><li class="level-2"><a class="final" href="/"><span>Welcome to Apache PredictionIO (incubating)</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Getting Started</span></a><ul><li class="level-2"><a class="final" href="/start/"><span>A Quick Intro</span></a></li><li class="level-2"><a class="final" href="/install/"><span>Installing Apache PredictionIO (incubating)</span></a></li><li class="level-2"><a class="final" href="/start/download/"><span>Downloading an Engine Template</span></a></li><li class="level-2"><a class="final" href="/start/deploy/"><span>Deploying Your First Engine</span></a></li><li class="level-2"><a class="final" href="/start/customize/"><span>Customizing the Engine</span></a></li></ul></li><li class="level-1
"><a class="expandible" href="#"><span>Integrating with Your App</span></a><ul><li class="level-2"><a class="final" href="/appintegration/"><span>App Integration Overview</span></a></li><li class="level-2"><a class="expandible" href="/sdk/"><span>List of SDKs</span></a><ul><li class="level-3"><a class="final" href="/sdk/java/"><span>Java & Android SDK</span></a></li><li class="level-3"><a class="final" href="/sdk/php/"><span>PHP SDK</span></a></li><li class="level-3"><a class="final" href="/sdk/python/"><span>Python SDK</span></a></li><li class="level-3"><a class="final" href="/sdk/ruby/"><span>Ruby SDK</span></a></li><li class="level-3"><a class="final" href="/sdk/community/"><span>Community Powered SDKs</span></a></li></ul></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Deploying an Engine</span></a><ul><li class="level-2"><a class="final" href="/deploy/"><span>Deploying as a Web Service</span></a></li><li class="level-2"><a class="final" href="/cli/#engine
-commands"><span>Engine Command-line Interface</span></a></li><li class="level-2"><a class="final" href="/deploy/monitoring/"><span>Monitoring Engine</span></a></li><li class="level-2"><a class="final" href="/deploy/engineparams/"><span>Setting Engine Parameters</span></a></li><li class="level-2"><a class="final" href="/deploy/enginevariants/"><span>Deploying Multiple Engine Variants</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Customizing an Engine</span></a><ul><li class="level-2"><a class="final" href="/customize/"><span>Learning DASE</span></a></li><li class="level-2"><a class="final" href="/customize/dase/"><span>Implement DASE</span></a></li><li class="level-2"><a class="final" href="/customize/troubleshooting/"><span>Troubleshooting Engine Development</span></a></li><li class="level-2"><a class="final" href="/api/current/#package"><span>Engine Scala APIs</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Coll
ecting and Analyzing Data</span></a><ul><li class="level-2"><a class="final" href="/datacollection/"><span>Event Server Overview</span></a></li><li class="level-2"><a class="final" href="/cli/#event-server-commands"><span>Event Server Command-line Interface</span></a></li><li class="level-2"><a class="final" href="/datacollection/eventapi/"><span>Collecting Data with REST/SDKs</span></a></li><li class="level-2"><a class="final" href="/datacollection/eventmodel/"><span>Events Modeling</span></a></li><li class="level-2"><a class="final" href="/datacollection/webhooks/"><span>Unifying Multichannel Data with Webhooks</span></a></li><li class="level-2"><a class="final" href="/datacollection/channel/"><span>Channel</span></a></li><li class="level-2"><a class="final" href="/datacollection/batchimport/"><span>Importing Data in Batch</span></a></li><li class="level-2"><a class="final" href="/datacollection/analytics/"><span>Using Analytics Tools</span></a></li></ul></li><li class="level-1"><
a class="expandible" href="#"><span>Choosing an Algorithm(s)</span></a><ul><li class="level-2"><a class="final" href="/algorithm/"><span>Built-in Algorithm Libraries</span></a></li><li class="level-2"><a class="final" href="/algorithm/switch/"><span>Switching to Another Algorithm</span></a></li><li class="level-2"><a class="final" href="/algorithm/multiple/"><span>Combining Multiple Algorithms</span></a></li><li class="level-2"><a class="final" href="/algorithm/custom/"><span>Adding Your Own Algorithms</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>ML Tuning and Evaluation</span></a><ul><li class="level-2"><a class="final" href="/evaluation/"><span>Overview</span></a></li><li class="level-2"><a class="final" href="/evaluation/paramtuning/"><span>Hyperparameter Tuning</span></a></li><li class="level-2"><a class="final" href="/evaluation/evaluationdashboard/"><span>Evaluation Dashboard</span></a></li><li class="level-2"><a class="final" href="/evalua
tion/metricchoose/"><span>Choosing Evaluation Metrics</span></a></li><li class="level-2"><a class="final" href="/evaluation/metricbuild/"><span>Building Evaluation Metrics</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>System Architecture</span></a><ul><li class="level-2"><a class="final" href="/system/"><span>Architecture Overview</span></a></li><li class="level-2"><a class="final" href="/system/anotherdatastore/"><span>Using Another Data Store</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Engine Template Gallery</span></a><ul><li class="level-2"><a class="final" href="/gallery/template-gallery/"><span>Browse</span></a></li><li class="level-2"><a class="final" href="/community/submit-template/"><span>Submit your Engine as a Template</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Demo Tutorials</span></a><ul><li class="level-2"><a class="final" href="/demo/tapster/"><span>Comics
Recommendation Demo</span></a></li><li class="level-2"><a class="final" href="/demo/community/"><span>Community Contributed Demo</span></a></li><li class="level-2"><a class="final" href="/demo/textclassification/"><span>Text Classification Engine Tutorial</span></a></li></ul></li><li class="level-1"><a class="expandible" href="/community/"><span>Getting Involved</span></a><ul><li class="level-2"><a class="final" href="/community/contribute-code/"><span>Contribute Code</span></a></li><li class="level-2"><a class="final" href="/community/contribute-documentation/"><span>Contribute Documentation</span></a></li><li class="level-2"><a class="final" href="/community/contribute-sdk/"><span>Contribute a SDK</span></a></li><li class="level-2"><a class="final" href="/community/contribute-webhook/"><span>Contribute a Webhook</span></a></li><li class="level-2"><a class="final" href="/community/projects/"><span>Community Projects</span></a></li></ul></li><li class="level-1"><a class="expandible
" href="#"><span>Getting Help</span></a><ul><li class="level-2"><a class="final" href="/resources/faq/"><span>FAQs</span></a></li><li class="level-2"><a class="final" href="/support/"><span>Support</span></a></li></ul></li><li class="level-1"><a class="expandible" href="#"><span>Resources</span></a><ul><li class="level-2"><a class="final" href="/resources/intellij/"><span>Developing Engines with IntelliJ IDEA</span></a></li><li class="level-2"><a class="final" href="/resources/upgrade/"><span>Upgrade Instructions</span></a></li><li class="level-2"><a class="final" href="/resources/glossary/"><span>Glossary</span></a></li></ul></li></ul></nav></div><div class="col-md-9 col-sm-12"><div class="content-header hidden-md hidden-lg"><div id="page-title"><h1>Quick Start - Similar Product Engine Template</h1></div></div><div id="table-of-content-wrapper"><h5>On this page</h5><aside id="table-of-contents"><ul> <li> <a href="#overview">Overview</a> </li> <li> <a href="#usage">Usage</a> </li> <
li> <a href="#1-install-and-run-predictionio">1. Install and Run PredictionIO</a> </li> <li> <a href="#2-create-a-new-engine-from-an-engine-template">2. Create a new Engine from an Engine Template</a> </li> <li> <a href="#3-generate-an-app-id-and-access-key">3. Generate an App ID and Access Key</a> </li> <li> <a href="#4-collecting-data">4. Collecting Data</a> </li> <li> <a href="#5-deploy-the-engine-as-a-service">5. Deploy the Engine as a Service</a> </li> <li> <a href="#6-use-the-engine">6. Use the Engine</a> </li> <li> <a href="#advanced-query">Advanced Query</a> </li> </ul> </aside><hr/><a id="edit-page-link" href="https://github.com/apache/incubator-predictionio/tree/livedoc/docs/manual/source/templates/similarproduct/quickstart.html.md.erb"><img src="/images/icons/edit-pencil-d6c1bb3d.png"/>Edit this page</a></div><div class="content-header hidden-sm hidden-xs"><div id="page-title"><h1>Quick Start - Similar Product Engine Template</h1></div></div><div class="content"><h2 id='o
verview' class='header-anchors'>Overview</h2><p>This engine template recommends products that are "similar" to the input product(s). Similarity is not defined by user or item attributes but by users' previous actions. By default, it uses 'view' action such that product A and B are considered similar if most users who view A also view B. The template can be customized to support other action types such as buy, rate, like..etc.</p><p>This template is ideal for recommending products to customers based on their recent actions. Using the IDs of the recently viewed products of a customer as the <em>Query</em>, the engine will predict other products that this customer may also like.</p><p>This approach works perfectly for customers who are <strong>first-time visitors</strong> or have not signed in. Recommendations are made dynamically in <em>real-time</em> based on the most recent product preference you provide in the <em>Query</em>. You can, therefore, recommend prod
ucts to visitors without knowing a long history about them.</p><p>You can also use this template to build the popular feature of Amazon: <strong>"Customers Who Viewed This Item Also Viewed..."</strong> quickly. Help your customers explore more products that they like, and sell more products.</p><h2 id='usage' class='header-anchors'>Usage</h2><h3 id='event-data-requirements' class='header-anchors'>Event Data Requirements</h3><p>By default, this template takes the following data from Event Server as Training Data:</p> <ul> <li>User <em>$set</em> events</li> <li>Item <em>$set</em> events with <em>categories</em> properties</li> <li>Users' <em>view</em> item events</li> </ul> <div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>buy</em>, <em>rate</em> and <em>like</em>. You can offer features like "Customers Who Bought This Item Also Bought....".</p></div><h3 id='input-query' class='header-anchors'>Inp
ut Query</h3> <ul> <li>List of ItemIDs, which are the targeted products</li> <li>N (number of items to be recommended)</li> <li>List of white-listed item categories (optional)</li> <li>List of white-listed ItemIds (optional)</li> <li>List of black-listed ItemIds (optional)</li> </ul> <p>The template also supports black-list and white-list. If a white-list is provided, the engine will include only those products in the recommendation. Likewise, if a black-list is provided, the engine will exclude those products in the recommendation.</p><h3 id='output-predictedresult' class='header-anchors'>Output PredictedResult</h3> <ul> <li>a ranked list of recommended itemIDs</li> </ul> <h2 id='1.-install-and-run-predictionio' class='header-anchors'>1. Install and Run PredictionIO</h2><p>First you need to <a href="/install">install PredictionIO 0.9.5</a> (if you haven't done it).</p><p>Let's say you have installed PredictionIO at <code>/home/yourname/PredictionIO/</code>. For convenience,
add PredictionIO's binary command path to your <code>PATH</code>, i.e. <code>/home/yourname/PredictionIO/bin</code>:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ </span><span class="nv">PATH</span><span class="o">=</span><span class="nv">$PATH</span>:/home/yourname/PredictionIO/bin; <span class="nb">export </span>PATH
</pre></td></tr></tbody></table> </div> <div class="alert-message note"><p>If you launched <strong>PredictionIO AWS instance</strong>, the path is located at <code>/opt/PredictionIO/bin</code>.</p></div><p>Once you have completed the installation process, please make sure all the components (PredictionIO Event Server, Elasticsearch, and HBase) are up and running.</p><div class="alert-message note"><p>If you launched <strong>PredictionIO AWS instance</strong>, you can skip <code>pio-start-all</code>. All components should have been started automatically.</p></div><p>If you are using PostgreSQL or MySQL, run the following to start PredictionIO Event Server:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ </span>pio eventserver &
</pre></td></tr></tbody></table> </div> <p>If instead you are running HBase and Elasticsearch, run the following to start all PredictionIO Event Server, HBase, and Elasticsearch:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ </span>pio-start-all
</pre></td></tr></tbody></table> </div> <p>You can check the status by running:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ </span>pio status
@@ -32,7 +32,7 @@ Your system is all ready to go.
<span class="o">[</span>INFO] <span class="o">[</span>App<span class="nv">$]</span> MyApp1 | 1 | 3mZWDzci2D5YsqAnqNnXH9SB6Rg3dsTBs8iHkK6X2i54IQsIZI1eEeQQyMfs7b3F | <span class="o">(</span>all<span class="o">)</span>
<span class="o">[</span>INFO] <span class="o">[</span>App<span class="nv">$]</span> MyApp2 | 2 | io5lz6Eg4m3Xe4JZTBFE13GMAf1dhFl6ZteuJfrO84XpdOz9wRCrDU44EUaYuXq5 | <span class="o">(</span>all<span class="o">)</span>
<span class="o">[</span>INFO] <span class="o">[</span>App<span class="nv">$]</span> Finished listing 2 app<span class="o">(</span>s<span class="o">)</span>.
-</pre></td></tr></tbody></table> </div> <p><a href="#"></a></p> <h2 id='4.-collecting-data' class='header-anchors'>4. Collecting Data</h2><p>Next, let's collect some training data for the app of this Engine. By default, the Similar Product Engine Template supports 2 types of entities: <strong>user</strong> and <strong>item</strong>, and event <strong>view</strong>. An item has the <strong>categories</strong> property, which is a list of category names (String). A user can view an item. Respectively, this template requires '$set' user event, '$set' item event, and user-view-item events.</p><div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>buy</em>, <em>rate</em> and <em>like</em>.</p></div><p>You can send these events to PredictionIO Event Server in real-time easily by making a HTTP request or through the provided SDK. Please see <a href="/appintegration/">App Integration Overview</a> for more detail
s how to integrate your app with SDK.</p><p>Let's try sending events to EventServer with the following <code>curl</code> commands (The corresponding SDK code is showed in other tabs).</p><p>Replace <code><ACCCESS_KEY></code> by the Access Key generated in above steps. Note that <code>localhost:7070</code> is the default URL of the Event Server.</p><p>For convenience, set your access key to the shell variable, run:</p><p><code>$ ACCESS_KEY=<ACCESS_KEY></code></p> <p><a href="#"></a></p> <p>For example, when a new user with id "u0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for this user. To send this event, run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-de08a042-2a8a-4583-bca0-fb2df4ae31c5">REST API</a></li> <li data-lang="python"><a href="#tab-7c88b244-609
b-4ec0-82f6-aa7d9ed3f3ed">Python SDK</a></li> <li data-lang="php"><a href="#tab-6debdfce-94ce-488c-b497-bf670dcb2f48">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-2d408349-7de7-4774-900d-53c63d57a4b3">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-fc634b64-8dbe-494a-a984-0c4be8c96c43">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-de08a042-2a8a-4583-bca0-fb2df4ae31c5"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td></tr></tbody></table> </div> <p><a href="#"></a></p> <h2 id='4.-collecting-data' class='header-anchors'>4. Collecting Data</h2><p>Next, let's collect some training data for the app of this Engine. By default, the Similar Product Engine Template supports 2 types of entities: <strong>user</strong> and <strong>item</strong>, and event <strong>view</strong>. An item has the <strong>categories</strong> property, which is a list of category names (String). A user can view an item. Respectively, this template requires '$set' user event, '$set' item event, and user-view-item events.</p><div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>buy</em>, <em>rate</em> and <em>like</em>.</p></div><p>You can send these events to PredictionIO Event Server in real-time easily by making a HTTP request or through the provided SDK. Please see <a href="/appintegration/">App Integration Overview</a> for more detail
s how to integrate your app with SDK.</p><p>Let's try sending events to EventServer with the following <code>curl</code> commands (The corresponding SDK code is showed in other tabs).</p><p>Replace <code><ACCCESS_KEY></code> by the Access Key generated in above steps. Note that <code>localhost:7070</code> is the default URL of the Event Server.</p><p>For convenience, set your access key to the shell variable, run:</p><p><code>$ ACCESS_KEY=<ACCESS_KEY></code></p> <p><a href="#"></a></p> <p>For example, when a new user with id "u0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for this user. To send this event, run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-ae3ed1ad-0b0b-421e-b6e8-f0d265ada621">REST API</a></li> <li data-lang="python"><a href="#tab-e3e52a29-817
b-421b-bd2c-6706407c59d6">Python SDK</a></li> <li data-lang="php"><a href="#tab-ea1cea2c-d9e6-4819-9b73-65089c003f7f">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-435672e2-0249-4dd2-ab31-acf1ace942ce">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-ebac50c0-7a5c-4188-bd00-d4e8eb34e45f">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-ae3ed1ad-0b0b-421e-b6e8-f0d265ada621"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -47,7 +47,7 @@ Your system is all ready to go.
"entityId" : "u0",
"eventTime" : "2014-11-02T09:39:45.618-08:00"
}'</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-7c88b244-609b-4ec0-82f6-aa7d9ed3f3ed"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-e3e52a29-817b-421b-bd2c-6706407c59d6"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -86,7 +86,7 @@ Your system is all ready to go.
<span class="n">event_time</span><span class="o">=</span><span class="n">datetime</span><span class="p">(</span>
<span class="mi">2014</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mo">02</span><span class="p">,</span> <span class="mi">09</span><span class="p">,</span> <span class="mi">39</span><span class="p">,</span> <span class="mi">45</span><span class="p">,</span> <span class="mi">618000</span><span class="p">,</span> <span class="n">pytz</span><span class="o">.</span><span class="n">timezone</span><span class="p">(</span><span class="s">'US/Pacific'</span><span class="p">)</span>
<span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-6debdfce-94ce-488c-b497-bf670dcb2f48"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-ea1cea2c-d9e6-4819-9b73-65089c003f7f"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -111,7 +111,7 @@ Your system is all ready to go.
<span class="s1">'entityId'</span> <span class="o">=></span> <span class="o"><</span><span class="nx">USER</span> <span class="nx">ID</span><span class="o">></span>
<span class="p">));</span>
<span class="cp">?></span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-2d408349-7de7-4774-900d-53c63d57a4b3"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-435672e2-0249-4dd2-ab31-acf1ace942ce"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -128,7 +128,7 @@ Your system is all ready to go.
<span class="s1">'user'</span><span class="p">,</span>
<span class="o"><</span><span class="no">USER</span> <span class="no">ID</span><span class="o">></span>
<span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-fc634b64-8dbe-494a-a984-0c4be8c96c43"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-ebac50c0-7a5c-4188-bd00-d4e8eb34e45f"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -153,7 +153,7 @@ Your system is all ready to go.
<span class="o">.</span><span class="na">entityType</span><span class="o">(</span><span class="s">"user"</span><span class="o">)</span>
<span class="o">.</span><span class="na">entityId</span><span class="o">(<</span><span class="n">USER_ID</span><span class="o">>);</span>
<span class="n">client</span><span class="o">.</span><span class="na">createEvent</span><span class="o">(</span><span class="n">userEvent</span><span class="o">);</span>
-</pre></td> </tr></tbody></table> </div> </div> </div> <p>When a new item "i0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for the item. Note that the item is set with categories properties: <code>"c1"</code> and <code>"c2"</code>. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-c763cd17-6277-4603-ba96-fb477314f658">REST API</a></li> <li data-lang="python"><a href="#tab-ba753782-b1c5-4bb2-b3db-5d9e20d11c37">Python SDK</a></li> <li data-lang="php"><a href="#tab-a1be1575-76d6-4f8c-a928-e9f8d7d1ca83">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-7eefc5f4-5337-4d9a-ac97-2c5772ec2f16">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-97134bf5-379d-4f34-b0bd-c1d59e48be42">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-c763cd
17-6277-4603-ba96-fb477314f658"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> </div> <p>When a new item "i0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for the item. Note that the item is set with categories properties: <code>"c1"</code> and <code>"c2"</code>. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-7573da34-c660-4f43-874d-8954fc5c93cd">REST API</a></li> <li data-lang="python"><a href="#tab-37c40134-d986-4f1b-bab0-dd83186d2728">Python SDK</a></li> <li data-lang="php"><a href="#tab-62f481ce-eb3b-4e9a-bf4b-05e580d9eff0">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-addbce4c-fcb0-430f-89cb-2e7bc5972337">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-9e7bfa07-f4e9-4143-b61a-b3eddabd1315">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-7573da
34-c660-4f43-874d-8954fc5c93cd"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -174,7 +174,7 @@ Your system is all ready to go.
}
"eventTime" : "2014-11-02T09:39:45.618-08:00"
}'</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-ba753782-b1c5-4bb2-b3db-5d9e20d11c37"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-37c40134-d986-4f1b-bab0-dd83186d2728"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -193,7 +193,7 @@ Your system is all ready to go.
<span class="s">"categories"</span> <span class="p">:</span> <span class="p">[</span><span class="s">"<CATEGORY_1>"</span><span class="p">,</span> <span class="s">"<CATEGORY_2>"</span><span class="p">]</span>
<span class="p">}</span>
<span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-a1be1575-76d6-4f8c-a928-e9f8d7d1ca83"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-62f481ce-eb3b-4e9a-bf4b-05e580d9eff0"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -214,7 +214,7 @@ Your system is all ready to go.
<span class="p">));</span>
<span class="cp">?></span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-7eefc5f4-5337-4d9a-ac97-2c5772ec2f16"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-addbce4c-fcb0-430f-89cb-2e7bc5972337"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -231,7 +231,7 @@ Your system is all ready to go.
<span class="p">}</span>
<span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-97134bf5-379d-4f34-b0bd-c1d59e48be42"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-9e7bfa07-f4e9-4143-b61a-b3eddabd1315"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -244,7 +244,7 @@ Your system is all ready to go.
<span class="o">.</span><span class="na">entityId</span><span class="o">(<</span><span class="n">ITEM_ID</span><span class="o">>)</span>
<span class="o">.</span><span class="na">property</span><span class="o">(</span><span class="s">"categories"</span><span class="o">,</span> <span class="n">ImmutableList</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"<CATEGORY_1>"</span><span class="o">,</span> <span class="s">"<CATEGORY_2>"</span><span class="o">));</span>
<span class="n">client</span><span class="o">.</span><span class="na">createEvent</span><span class="o">(</span><span class="n">itemEvent</span><span class="o">)</span>
-</pre></td> </tr></tbody></table> </div> </div> </div> <p>When the user "u0" view item "i0" on time <code>2014-11-10T12:34:56.123-08:00</code> (current time will be used if eventTime is not specified), you can send a view event. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-28513053-9393-431b-b2b8-1ce66ae9f6a0">REST API</a></li> <li data-lang="python"><a href="#tab-83144550-db77-4375-a515-62d7feaee763">Python SDK</a></li> <li data-lang="php"><a href="#tab-6e903d01-f421-4d1e-9f9b-dc282f0b205d">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-f1b90b6d-873d-4c63-9ff5-6a0f7fce9347">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-27a5086b-b2eb-4c67-ba82-28edc863c889">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-28513053-9393-431b-b2b8-1ce66ae9f6a0"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text
-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> </div> <p>When the user "u0" view item "i0" on time <code>2014-11-10T12:34:56.123-08:00</code> (current time will be used if eventTime is not specified), you can send a view event. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-6d52a753-c48c-482f-a8f6-a680c25a800f">REST API</a></li> <li data-lang="python"><a href="#tab-0bb05f03-550f-49b7-91cf-2e11262b936f">Python SDK</a></li> <li data-lang="php"><a href="#tab-79c0b23f-fc32-42f1-8401-65a81d179e37">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-5c3b0cb5-58bb-49a8-ba8c-ce1058eb3ca5">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-b65d3a1e-d2f4-4d34-af7f-48f215828827">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-6d52a753-c48c-482f-a8f6-a680c25a800f"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text
-align: right"><pre class="lineno">1
2
3
4
@@ -263,7 +263,7 @@ Your system is all ready to go.
"targetEntityId" : "i0",
"eventTime" : "2014-11-10T12:34:56.123-08:00"
}'</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-83144550-db77-4375-a515-62d7feaee763"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-0bb05f03-550f-49b7-91cf-2e11262b936f"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -280,7 +280,7 @@ Your system is all ready to go.
<span class="n">target_entity_type</span><span class="o">=</span><span class="s">"item"</span><span class="p">,</span>
<span class="n">target_entity_id</span><span class="o">=<</span><span class="n">ITEM</span> <span class="n">ID</span><span class="o">></span>
<span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-6e903d01-f421-4d1e-9f9b-dc282f0b205d"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-79c0b23f-fc32-42f1-8401-65a81d179e37"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -299,7 +299,7 @@ Your system is all ready to go.
<span class="s1">'targetEntityId'</span> <span class="o">=></span> <span class="o"><</span><span class="nx">ITEM</span> <span class="nx">ID</span><span class="o">></span>
<span class="p">));</span>
<span class="cp">?></span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-f1b90b6d-873d-4c63-9ff5-6a0f7fce9347"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-5c3b0cb5-58bb-49a8-ba8c-ce1058eb3ca5"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -316,7 +316,7 @@ Your system is all ready to go.
<span class="s1">'targetEntityId'</span> <span class="o">=></span> <span class="o"><</span><span class="no">ITEM</span> <span class="no">ID</span><span class="o">></span>
<span class="p">}</span>
<span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-27a5086b-b2eb-4c67-ba82-28edc863c889"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-b65d3a1e-d2f4-4d34-af7f-48f215828827"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -376,19 +376,19 @@ User u10 views item i29
</pre></td></tr></tbody></table> </div> <p>When the engine is deployed successfully and running, you should see a console message similar to the following:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1
2</pre></td><td class="code"><pre><span class="o">[</span>INFO] <span class="o">[</span>HttpListener] Bound to /0.0.0.0:8000
<span class="o">[</span>INFO] <span class="o">[</span>MasterActor] Bind successful. Ready to serve.
-</pre></td></tr></tbody></table> </div> <p>Do not kill the deployed engine process.</p><p>By default, the deployed engine binds to <a href="http://localhost:8000"><a href="http://localhost:8000">http://localhost:8000</a></a>. You can visit that page in your web browser to check its status.</p><p><img alt="Engine Status" src="/images/engine-server-3246414b.png"/></p></p><h2 id='6.-use-the-engine' class='header-anchors'>6. Use the Engine</h2><p>Now, You can retrieve predicted results. To retrieve 4 items which are similar to item ID "i1". You send this JSON <code>{ "items": ["i1"], "num": 4 }</code> to the deployed engine and it will return a JSON of the recommended items. Simply send a query by making a HTTP request or through the <code>EngineClient</code> of an SDK.</p><p>With the deployed engine running, open another terminal and run the following <code>curl</code> command or use SDK to send the query:</p><div class="tabs"> <ul class="control
"> <li data-lang="json"><a href="#tab-418614f8-aa5b-4afc-9041-299fd61bfa3f">REST API</a></li> <li data-lang="python"><a href="#tab-3d85e95e-25c0-4cdf-8dc0-4563d76e2d4d">Python SDK</a></li> <li data-lang="php"><a href="#tab-ea4257e3-4439-4066-8327-ec63d467cc3b">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-902aebe5-e5f2-45da-83b9-9adaec7c2f9b">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-f44c73c3-bb2c-4973-be3e-2fb79dbdf7aa">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-418614f8-aa5b-4afc-9041-299fd61bfa3f"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td></tr></tbody></table> </div> <p>Do not kill the deployed engine process.</p><p>By default, the deployed engine binds to <a href="http://localhost:8000"><a href="http://localhost:8000">http://localhost:8000</a></a>. You can visit that page in your web browser to check its status.</p><p><img alt="Engine Status" src="/images/engine-server-3246414b.png"/></p></p><h2 id='6.-use-the-engine' class='header-anchors'>6. Use the Engine</h2><p>Now, You can retrieve predicted results. To retrieve 4 items which are similar to item ID "i1". You send this JSON <code>{ "items": ["i1"], "num": 4 }</code> to the deployed engine and it will return a JSON of the recommended items. Simply send a query by making a HTTP request or through the <code>EngineClient</code> of an SDK.</p><p>With the deployed engine running, open another terminal and run the following <code>curl</code> command or use SDK to send the query:</p><div class="tabs"> <ul class="control
"> <li data-lang="json"><a href="#tab-6d4f1247-289a-4ed4-82d8-34c816c56179">REST API</a></li> <li data-lang="python"><a href="#tab-bb4d0331-39b2-4d90-bf7b-3809be98de51">Python SDK</a></li> <li data-lang="php"><a href="#tab-cb127f2b-da17-40fd-846c-d8c37f6232b7">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-8e55b60b-991f-45ff-88a9-ddc765f3983c">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-f0b5f391-e59f-4408-b6fa-1e999da3ea11">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-6d4f1247-289a-4ed4-82d8-34c816c56179"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4</pre></td> <td class="code"><pre><span class="gp">$ </span>curl -H <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span>
-d <span class="s1">'{ "items": ["i1"], "num": 4 }'</span> <span class="se">\</span>
http://localhost:8000/queries.json
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-3d85e95e-25c0-4cdf-8dc0-4563d76e2d4d"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-bb4d0331-39b2-4d90-bf7b-3809be98de51"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3</pre></td> <td class="code"><pre><span class="kn">import</span> <span class="nn">predictionio</span>
<span class="n">engine_client</span> <span class="o">=</span> <span class="n">predictionio</span><span class="o">.</span><span class="n">EngineClient</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="s">"http://localhost:8000"</span><span class="p">)</span>
<span class="k">print</span> <span class="n">engine_client</span><span class="o">.</span><span class="n">send_query</span><span class="p">({</span><span class="s">"items"</span><span class="p">:</span> <span class="p">[</span><span class="s">"i1"</span><span class="p">],</span> <span class="s">"num"</span><span class="p">:</span> <span class="mi">4</span><span class="p">})</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-ea4257e3-4439-4066-8327-ec63d467cc3b"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-cb127f2b-da17-40fd-846c-d8c37f6232b7"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -407,7 +407,7 @@ http://localhost:8000/queries.json
<span class="nb">print_r</span><span class="p">(</span><span class="nv">$response</span><span class="p">);</span>
<span class="cp">?></span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-902aebe5-e5f2-45da-83b9-9adaec7c2f9b"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-8e55b60b-991f-45ff-88a9-ddc765f3983c"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
@@ -420,7 +420,7 @@ http://localhost:8000/queries.json
<span class="n">response</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="nf">send_query</span><span class="p">(</span><span class="s1">'items'</span> <span class="o">=></span> <span class="p">[</span><span class="s1">'i1'</span><span class="p">],</span> <span class="s1">'num'</span> <span class="o">=></span> <span class="mi">4</span><span class="p">)</span>
<span class="nb">puts</span> <span class="n">response</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-f44c73c3-bb2c-4973-be3e-2fb79dbdf7aa"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-f0b5f391-e59f-4408-b6fa-1e999da3ea11"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1
2
3
4
http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/f6e7c2b4/templates/similarproduct/quickstart/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/similarproduct/quickstart/index.html.gz b/templates/similarproduct/quickstart/index.html.gz
index 26b70ac..2c17abb 100644
Binary files a/templates/similarproduct/quickstart/index.html.gz and b/templates/similarproduct/quickstart/index.html.gz differ
http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/f6e7c2b4/templates/vanilla/dase/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/vanilla/dase/index.html.gz b/templates/vanilla/dase/index.html.gz
index 7327118..d5d01da 100644
Binary files a/templates/vanilla/dase/index.html.gz and b/templates/vanilla/dase/index.html.gz differ