http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c17b9607/templates/productranking/quickstart/index.html
----------------------------------------------------------------------
diff --git a/templates/productranking/quickstart/index.html 
b/templates/productranking/quickstart/index.html
index 8c2bb6f..3e9ee50 100644
--- a/templates/productranking/quickstart/index.html
+++ b/templates/productranking/quickstart/index.html
@@ -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&#39;s collect some training data for the app of this Engine. By default, 
the Product Ranking Engine Template supports 2 types of entities: 
<strong>user</strong> and <strong>item</strong>, and event 
<strong>view</strong>. A user can view an item. This template requires 
&#39;$set&#39; user event, &#39;$set&#39; item event and user-view-item 
events.</p> <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 details 
how to integrate your app with SDK.</p><p>Let&#39;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>&lt;ACCCESS_KEY&gt;</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=&lt;ACCESS_KEY&gt;</code></p> <p><a 
href="#"></a></p> <p>For example, when a new user with id &quot;u0&quot; 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-f6c7ce95-0cf0-45b3-a2fb-ae39a3f662ac">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-316df7bc-9424-4830-ba9f-c6d4aee0cafd">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-b44618aa-c555-43cb-bfda-016e49ffdbe2">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-8764afe4-ca50-4c6b-8ceb-4519fc045f35">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-c9f5bff6-c898-45f6
 -ab1f-0ec3fd6ca056">Java SDK</a></li> </ul> <div data-tab="REST API" 
data-lang="json" id="tab-f6c7ce95-0cf0-45b3-a2fb-ae39a3f662ac"> <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&#39;s collect some training data for the app of this Engine. By default, 
the Product Ranking Engine Template supports 2 types of entities: 
<strong>user</strong> and <strong>item</strong>, and event 
<strong>view</strong>. A user can view an item. This template requires 
&#39;$set&#39; user event, &#39;$set&#39; item event and user-view-item 
events.</p> <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 details 
how to integrate your app with SDK.</p><p>Let&#39;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>&lt;ACCCESS_KEY&gt;</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=&lt;ACCESS_KEY&gt;</code></p> <p><a 
href="#"></a></p> <p>For example, when a new user with id &quot;u0&quot; 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-a870a4b2-9b66-4d27-ba2f-b0b5b77a9b80">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-465b7cf9-5be4-4634-b934-5bbbe0df0a84">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-804a0f50-54f6-4cfb-8825-aec74c5517c7">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-6c5fee9e-50a1-4e82-8cec-5c06be2d7aaa">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-61197684-19e5-4206
 -ae56-3792784c5600">Java SDK</a></li> </ul> <div data-tab="REST API" 
data-lang="json" id="tab-a870a4b2-9b66-4d27-ba2f-b0b5b77a9b80"> <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-316df7bc-9424-4830-ba9f-c6d4aee0cafd"> <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-465b7cf9-5be4-4634-b934-5bbbe0df0a84"> <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
@@ -78,7 +78,7 @@ Your system is all ready to go.
   <span class="n">entity_type</span><span class="o">=</span><span 
class="s">"user"</span><span class="p">,</span>
   <span class="n">entity_id</span><span class="o">=&lt;</span><span 
class="n">USER_ID</span><span class="o">&gt;</span>
 <span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" 
data-lang="php" id="tab-b44618aa-c555-43cb-bfda-016e49ffdbe2"> <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-804a0f50-54f6-4cfb-8825-aec74c5517c7"> <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
@@ -103,7 +103,7 @@ Your system is all ready to go.
   <span class="s1">'entityId'</span> <span class="o">=&gt;</span> <span 
class="o">&lt;</span><span class="nx">USER</span> <span 
class="nx">ID</span><span class="o">&gt;</span>
 <span class="p">));</span>
 <span class="cp">?&gt;</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" 
data-lang="ruby" id="tab-8764afe4-ca50-4c6b-8ceb-4519fc045f35"> <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-6c5fee9e-50a1-4e82-8cec-5c06be2d7aaa"> <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
@@ -120,7 +120,7 @@ Your system is all ready to go.
   <span class="s1">'user'</span><span class="p">,</span>
   <span class="o">&lt;</span><span class="no">USER</span> <span 
class="no">ID</span><span class="o">&gt;</span>
 <span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" 
data-lang="java" id="tab-c9f5bff6-c898-45f6-ab1f-0ec3fd6ca056"> <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-61197684-19e5-4206-ae56-3792784c5600"> <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
@@ -145,7 +145,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">(&lt;</span><span class="n">USER_ID</span><span 
class="o">&gt;);</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 
&quot;i0&quot; 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. Run the following <code>curl</code> command:</p><div class="tabs"> <ul 
class="control"> <li data-lang="json"><a 
href="#tab-c123e2b4-ec0c-4747-afe3-99970dd8d457">REST API</a></li> <li 
data-lang="python"><a href="#tab-687f83e3-f39a-44fa-a360-5a7e346f7df2">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-9b08ae83-4061-4a67-a6ba-583868b277f9">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-234fbf42-8a23-488a-8a6a-154a498a2bf9">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-534577d4-b2be-41b1-8e9d-a7088ed5929f">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-c123e2b4-ec0c-4747-afe3-99970dd8d457"> <div class="highlight shell"> 
<table style="border-spacing: 0"><tbody><tr> <td cla
 ss="gutter gl" style="text-align: right"><pre class="lineno">1
+</pre></td> </tr></tbody></table> </div> </div> </div> <p>When a new item 
&quot;i0&quot; 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. Run the following <code>curl</code> command:</p><div class="tabs"> <ul 
class="control"> <li data-lang="json"><a 
href="#tab-edc4d81a-2db0-4a4d-a5fe-1c58088624b2">REST API</a></li> <li 
data-lang="python"><a href="#tab-6f619515-acdd-4ee4-88de-8789b828d954">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-c91ba414-f24f-4677-a461-41e17b474c7a">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-316c0bec-2f4c-49f9-9c8a-b714828ddc5e">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-4fb970eb-67d9-4939-8700-c1ecbdc9357b">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-edc4d81a-2db0-4a4d-a5fe-1c58088624b2"> <div class="highlight shell"> 
<table style="border-spacing: 0"><tbody><tr> <td cla
 ss="gutter gl" style="text-align: right"><pre class="lineno">1
 2
 3
 4
@@ -160,7 +160,7 @@ Your system is all ready to go.
   "entityId" : "i0",
   "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-687f83e3-f39a-44fa-a360-5a7e346f7df2"> <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-6f619515-acdd-4ee4-88de-8789b828d954"> <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
@@ -173,7 +173,7 @@ Your system is all ready to go.
   <span class="n">entity_type</span><span class="o">=</span><span 
class="s">"item"</span><span class="p">,</span>
   <span class="n">entity_id</span><span class="o">=&lt;</span><span 
class="n">ITEM_ID</span><span class="o">&gt;</span>
 <span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" 
data-lang="php" id="tab-9b08ae83-4061-4a67-a6ba-583868b277f9"> <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-c91ba414-f24f-4677-a461-41e17b474c7a"> <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
@@ -190,7 +190,7 @@ Your system is all ready to go.
 <span class="p">));</span>
 
 <span class="cp">?&gt;</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" 
data-lang="ruby" id="tab-234fbf42-8a23-488a-8a6a-154a498a2bf9"> <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-316c0bec-2f4c-49f9-9c8a-b714828ddc5e"> <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
@@ -203,7 +203,7 @@ Your system is all ready to go.
   <span class="o">&lt;</span><span class="no">ITEM</span> <span 
class="no">ID</span><span class="o">&gt;</span>
 <span class="p">)</span>
 
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" 
data-lang="java" id="tab-534577d4-b2be-41b1-8e9d-a7088ed5929f"> <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-4fb970eb-67d9-4939-8700-c1ecbdc9357b"> <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
@@ -214,7 +214,7 @@ Your system is all ready to go.
   <span class="o">.</span><span class="na">entityType</span><span 
class="o">(</span><span class="s">"item"</span><span class="o">)</span>
   <span class="o">.</span><span class="na">entityId</span><span 
class="o">(&lt;</span><span class="n">ITEM_ID</span><span 
class="o">&gt;);</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 
&quot;u0&quot; view item &quot;i0&quot; 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-c2ff15f5-714e-4235-9603-e912637e0ca4">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-28a67892-4244-4124-9964-271897eabc92">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-5c824856-ab08-47c2-9099-7713f336caaf">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-20bfad51-2935-47a2-bb14-63e6d6aac973">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-c08337e0-539f-4567-8121-eaf956e42bc3">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-c2ff15f5-714e-4235-9603-e912637e0ca4"> <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 
&quot;u0&quot; view item &quot;i0&quot; 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-b2f6de76-4058-41e9-b6db-30d5b900f25f">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-139a990a-3269-4a72-a2a7-9c83dab0658d">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-143a1e87-3443-4e4a-9a16-4041886f4cd0">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-7faa37dc-3aaf-44fb-9677-0db6cc0a9808">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-ce687ae9-f404-4464-9c7b-fa07cb439159">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-b2f6de76-4058-41e9-b6db-30d5b900f25f"> <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
@@ -233,7 +233,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-28a67892-4244-4124-9964-271897eabc92"> <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-139a990a-3269-4a72-a2a7-9c83dab0658d"> <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
@@ -250,7 +250,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">=&lt;</span><span 
class="n">ITEM</span> <span class="n">ID</span><span class="o">&gt;</span>
 <span class="p">)</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" 
data-lang="php" id="tab-5c824856-ab08-47c2-9099-7713f336caaf"> <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-143a1e87-3443-4e4a-9a16-4041886f4cd0"> <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
@@ -269,7 +269,7 @@ Your system is all ready to go.
    <span class="s1">'targetEntityId'</span> <span class="o">=&gt;</span> <span 
class="o">&lt;</span><span class="nx">ITEM</span> <span 
class="nx">ID</span><span class="o">&gt;</span>
 <span class="p">));</span>
 <span class="cp">?&gt;</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" 
data-lang="ruby" id="tab-20bfad51-2935-47a2-bb14-63e6d6aac973"> <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-7faa37dc-3aaf-44fb-9677-0db6cc0a9808"> <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
@@ -286,7 +286,7 @@ Your system is all ready to go.
     <span class="s1">'targetEntityId'</span> <span class="o">=&gt;</span> 
<span class="o">&lt;</span><span class="no">ITEM</span> <span 
class="no">ID</span><span class="o">&gt;</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-c08337e0-539f-4567-8121-eaf956e42bc3"> <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-ce687ae9-f404-4464-9c7b-fa07cb439159"> <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
@@ -344,14 +344,14 @@ User u10 views item i7
 </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 rank items with IDs &quot;i1&quot;, &quot;i3&quot;, 
&quot;i10&quot;, &quot;i2&quot;, &quot;i5&quot;, &quot;i31&quot;, 
&quot;i9&quot; for user &quot;u2&quot;. You send this JSON <code>{ 
&quot;user&quot;: &quot;u2&quot;, &quot;items&quot;: [&quot;i1&quot;, 
&quot;i3&quot;, &quot;i10&quot;, &quot;i2&quot;, &quot;i5&quot;, 
&quot;i31&quot;, &quot;i9&quot;] }</code> to the deployed engine and it will 
return a JSON of the ranked items. Simply send a query by making a HTTP request 
or through the <code>EngineCl
 ient</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-e21bb54d-c52b-47d8-972f-1d5b92593ec0">REST API</a></li> <li 
data-lang="python"><a href="#tab-92d50e54-9aaa-4e72-8a18-d667572ac2e8">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-7c13ef7b-8216-4f7d-b03d-65a1c5f2665b">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-e92ec963-5243-4026-a73c-fef3821dd823">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-c6ae3acd-18c6-4285-a4e6-773feec019c0">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-e21bb54d-c52b-47d8-972f-1d5b92593ec0"> <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 rank items with IDs &quot;i1&quot;, &quot;i3&quot;, 
&quot;i10&quot;, &quot;i2&quot;, &quot;i5&quot;, &quot;i31&quot;, 
&quot;i9&quot; for user &quot;u2&quot;. You send this JSON <code>{ 
&quot;user&quot;: &quot;u2&quot;, &quot;items&quot;: [&quot;i1&quot;, 
&quot;i3&quot;, &quot;i10&quot;, &quot;i2&quot;, &quot;i5&quot;, 
&quot;i31&quot;, &quot;i9&quot;] }</code> to the deployed engine and it will 
return a JSON of the ranked items. Simply send a query by making a HTTP request 
or through the <code>EngineCl
 ient</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-2426c8a7-b0bd-4ec1-9e9d-93fadca970a6">REST API</a></li> <li 
data-lang="python"><a href="#tab-ae7e0c2d-ffcd-480f-bbd9-9a92a87c9d1b">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-7600643d-c044-40b8-af28-3e1223f41d24">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-e26dbd1d-1509-4aad-95a6-369834b62185">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-e6eb9cef-be5d-4270-9834-3536af7f2e47">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-2426c8a7-b0bd-4ec1-9e9d-93fadca970a6"> <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">'{ "user": "u2", "items": ["i1", "i3", "i10", "i2", "i5", 
"i31", "i9"]}'</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-92d50e54-9aaa-4e72-8a18-d667572ac2e8"> <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-ae7e0c2d-ffcd-480f-bbd9-9a92a87c9d1b"> <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
@@ -362,7 +362,7 @@ http://localhost:8000/queries.json
   <span class="s">"user"</span><span class="p">:</span> <span 
class="s">"u2"</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">"i3"</span><span class="p">,</span> <span class="s">"i10"</span><span 
class="p">,</span> <span class="s">"i2"</span><span class="p">,</span> <span 
class="s">"i5"</span><span class="p">,</span> <span class="s">"i31"</span><span 
class="p">,</span> <span class="s">"i9"</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-7c13ef7b-8216-4f7d-b03d-65a1c5f2665b"> <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-7600643d-c044-40b8-af28-3e1223f41d24"> <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
@@ -385,7 +385,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">?&gt;</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" 
data-lang="ruby" id="tab-e92ec963-5243-4026-a73c-fef3821dd823"> <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-e26dbd1d-1509-4aad-95a6-369834b62185"> <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
@@ -402,7 +402,7 @@ http://localhost:8000/queries.json
   <span class="s1">'items'</span> <span class="o">=&gt;</span> <span 
class="p">[</span><span class="s1">'i1'</span><span class="p">,</span> <span 
class="s1">'i3'</span><span class="p">,</span> <span 
class="s1">'i10'</span><span class="p">,</span> <span 
class="s1">'i2'</span><span class="p">,</span> <span 
class="s1">'i5'</span><span class="p">,</span> <span 
class="s1">'i31'</span><span class="p">,</span> <span 
class="s1">'i9'</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-c6ae3acd-18c6-4285-a4e6-773feec019c0"> <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-e6eb9cef-be5d-4270-9834-3536af7f2e47"> <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/predictionio-site/blob/c17b9607/templates/recommendation/batch-evaluator/index.html
----------------------------------------------------------------------
diff --git a/templates/recommendation/batch-evaluator/index.html 
b/templates/recommendation/batch-evaluator/index.html
index 392eb7a..d6888ca 100644
--- a/templates/recommendation/batch-evaluator/index.html
+++ b/templates/recommendation/batch-evaluator/index.html
@@ -59,7 +59,7 @@
     <span class="nc">Seq</span><span class="o">(</span><span 
class="n">evalDataSet</span><span class="o">)</span>
   <span class="o">}</span>
 
-</pre></td></tr></tbody></table> </div> <div class="alert-message 
note"><p>Alternatively, you can create a new DataSource extending original 
DataSource. Then you can add the new one in Engine.scala and specify which one 
to use in engine.json.</p></div> <h2 id='2.-add-a-new-evaluator' 
class='header-anchors'>2. Add a new Evaluator</h2><p>Create a new file 
<code>BatchPersistableEvaluator.scala</code>. Unlike the 
<code>MetricEvaluator</code>, this Evaluator simply writes the Query and 
correpsonding PredictedResult to the output directory without performaning any 
metrics calculation.</p><p>Note that output directory is specified by the 
variable <code>outputDir</code>.</p><div class="highlight scala"><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 class="alert-message 
note"><p>Alternatively, you can create a new DataSource extending original 
DataSource. Then you can add the new one in Engine.scala and specify which one 
to use in engine.json.</p></div> <h2 id='2.-add-a-new-evaluator' 
class='header-anchors'>2. Add a new Evaluator</h2><p>Create a new file 
<code>BatchPersistableEvaluator.scala</code>. Unlike the 
<code>MetricEvaluator</code>, this Evaluator simply writes the Query and 
corresponding PredictedResult to the output directory without performing any 
metrics calculation.</p><p>Note that output directory is specified by the 
variable <code>outputDir</code>.</p><div class="highlight scala"><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/predictionio-site/blob/c17b9607/templates/recommendation/evaluation/index.html
----------------------------------------------------------------------
diff --git a/templates/recommendation/evaluation/index.html 
b/templates/recommendation/evaluation/index.html
index 933407a..3cd1dc2 100644
--- a/templates/recommendation/evaluation/index.html
+++ b/templates/recommendation/evaluation/index.html
@@ -111,7 +111,7 @@ Metrics:
   PositiveCount <span class="o">(</span><span class="nv">threshold</span><span 
class="o">=</span>1.0<span class="o">)</span>: 10.006666666666666
 <span class="o">[</span>INFO 2015-03-31 00:36:01,516] <span 
class="o">[</span>CoreWorkflow<span class="nv">$]</span> runEvaluation completed
 
-</pre></td></tr></tbody></table> </div> <p>The console prints out the 
evaluation meric score of each engine params, and finally pretty print the 
optimal engine params. Amongs the 3 engine params we evaluate, the best 
Prediction@k has a score of ~0.1521.</p><h2 id='the-evaluation-design' 
class='header-anchors'>The Evaluation Design</h2><p>We assume you have read the 
<a href="/evaluation">Tuning and Evaluation</a> section. We will cover the 
evaluation aspects which are specific to the recommendation engine.</p><p>In 
recommendation evaluation, the raw data is a sequence of known ratings. A 
rating has 3 components: user, item, and a score. We use the $k-fold$ method 
for evaluation, the raw data is sliced into a sequence of (training, 
validation) data tuple.</p><p>In the validation data, we construct a query for 
<em>each user</em>, and get a list of recommended items from the engine. It is 
vastly different from the classification tutorial, where there is a one-to-one 
corresponding betwee
 n the training data point and the validation data point. In this evaluation, 
our unit of evaluation is <em>user</em>, we evaluate the quality of an engine 
using the known rating of a user.</p><h3 id='key-assumptions' 
class='header-anchors'>Key assumptions</h3><p>There are multiple assumptions we 
have to make when we evaluate a recommendation engine:</p> <ul> 
<li><p>Definition of &#39;good&#39;. We want to quantify if the engine is able 
to recommend items which the user likes, we need to define what is meant by 
&#39;good&#39;. In this examle, we have two kinds of events: &#39;rate&#39; and 
&#39;buy&#39;. The &#39;rate&#39; event is associated with a rating value which 
ranges between 1 to 4, and the &#39;buy&#39; event is mapped to a rating of 4. 
When we implement the metric, we have to specify a rating threshold, only the 
rating above the threshold is considered &#39;good&#39;.</p></li> <li><p>The 
absense of complete rating. It is extremely unlikely that the training data 
contains ra
 ting for all user-item tuples. In contrast, of a system containing 1000 items, 
a user may only have rated 20 of them, leaving 980 items unrated. There is no 
way for us to certainly tell if the user likes an unrated product. When we 
examine the evaluation result, it is important for us to keep in mind that the 
final metric is only an approximation of the actual result.</p></li> 
<li><p>Recommendation affects user behavior. Suppose you are a e-commerce 
company and would like to use the recommendation engine to personalize the 
landing page, the item you show in the langing page directly impacts what the 
user is going to purchase. This is different from weather prediction, whatever 
the weather forecast engine predicts, tomorrow&#39;s weather won&#39;t be 
affected. Therefore, when we conduct offline evaluation for recommendation 
engines, it is possible that the final user behavior is dramatically different 
from the evaluation result. However, in the evaluation, for simplicity, we have 
to 
 assume that user behavior is homogenous.</p></li> </ul> <h2 
id='evaluation-data-generation' class='header-anchors'>Evaluation Data 
Generation</h2><h3 id='actual-result' class='header-anchors'>Actual 
Result</h3><p>In 
MyRecommendation/src/main/scala/<strong><em>Engine.scala</em></strong>, we 
define the <code>ActualResult</code> which represents the user rating for 
validation. It stores the list of ratings in the validation set for a 
user.</p><div class="highlight scala"><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>The console prints out the 
evaluation meric score of each engine params, and finally pretty print the 
optimal engine params. Amongs the 3 engine params we evaluate, the best 
Prediction@k has a score of ~0.1521.</p><h2 id='the-evaluation-design' 
class='header-anchors'>The Evaluation Design</h2><p>We assume you have read the 
<a href="/evaluation">Tuning and Evaluation</a> section. We will cover the 
evaluation aspects which are specific to the recommendation engine.</p><p>In 
recommendation evaluation, the raw data is a sequence of known ratings. A 
rating has 3 components: user, item, and a score. We use the $k-fold$ method 
for evaluation, the raw data is sliced into a sequence of (training, 
validation) data tuple.</p><p>In the validation data, we construct a query for 
<em>each user</em>, and get a list of recommended items from the engine. It is 
vastly different from the classification tutorial, where there is a one-to-one 
corresponding betwee
 n the training data point and the validation data point. In this evaluation, 
our unit of evaluation is <em>user</em>, we evaluate the quality of an engine 
using the known rating of a user.</p><h3 id='key-assumptions' 
class='header-anchors'>Key assumptions</h3><p>There are multiple assumptions we 
have to make when we evaluate a recommendation engine:</p> <ul> 
<li><p>Definition of &#39;good&#39;. We want to quantify if the engine is able 
to recommend items which the user likes, we need to define what is meant by 
&#39;good&#39;. In this examle, we have two kinds of events: &#39;rate&#39; and 
&#39;buy&#39;. The &#39;rate&#39; event is associated with a rating value which 
ranges between 1 to 4, and the &#39;buy&#39; event is mapped to a rating of 4. 
When we implement the metric, we have to specify a rating threshold, only the 
rating above the threshold is considered &#39;good&#39;.</p></li> <li><p>The 
absence of complete rating. It is extremely unlikely that the training data 
contains ra
 ting for all user-item tuples. In contrast, of a system containing 1000 items, 
a user may only have rated 20 of them, leaving 980 items unrated. There is no 
way for us to certainly tell if the user likes an unrated product. When we 
examine the evaluation result, it is important for us to keep in mind that the 
final metric is only an approximation of the actual result.</p></li> 
<li><p>Recommendation affects user behavior. Suppose you are a e-commerce 
company and would like to use the recommendation engine to personalize the 
landing page, the item you show in the langing page directly impacts what the 
user is going to purchase. This is different from weather prediction, whatever 
the weather forecast engine predicts, tomorrow&#39;s weather won&#39;t be 
affected. Therefore, when we conduct offline evaluation for recommendation 
engines, it is possible that the final user behavior is dramatically different 
from the evaluation result. However, in the evaluation, for simplicity, we have 
to 
 assume that user behavior is homogenous.</p></li> </ul> <h2 
id='evaluation-data-generation' class='header-anchors'>Evaluation Data 
Generation</h2><h3 id='actual-result' class='header-anchors'>Actual 
Result</h3><p>In 
MyRecommendation/src/main/scala/<strong><em>Engine.scala</em></strong>, we 
define the <code>ActualResult</code> which represents the user rating for 
validation. It stores the list of ratings in the validation set for a 
user.</p><div class="highlight scala"><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="k">case</span> <span 
class="k">class</span> <span class="nc">ActualResult</span><span 
class="o">(</span>
   <span class="n">ratings</span><span class="k">:</span> <span 
class="kt">Array</span><span class="o">[</span><span 
class="kt">Rating</span><span class="o">]</span>


Reply via email to