http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/9fe018b6/templates/javaecommercerecommendation/dase/index.html
----------------------------------------------------------------------
diff --git a/templates/javaecommercerecommendation/dase/index.html 
b/templates/javaecommercerecommendation/dase/index.html
index 89f4166..befd134 100644
--- a/templates/javaecommercerecommendation/dase/index.html
+++ b/templates/javaecommercerecommendation/dase/index.html
@@ -339,7 +339,7 @@
 
     <span class="o">...</span>
 <span class="o">}</span>
-</pre></td></tr></tbody></table> </div> <p>Parameter description:</p> <ul> 
<li><strong>appName</strong>: Your App name. Events defined by 
&quot;seenItemEvents&quot; and &quot;similarItemEvents&quot; will be read from 
this app during <code>predict</code>.</li> <li><strong>unseenOnly</strong>: 
true or false. Set to true if you want to recommmend unseen items only. Seen 
items are defined by <em>seenItemEvents</em> which mean if the user has these 
events on the items, then it&#39;s treated as <em>seen</em>.</li> 
<li><strong>seenItemEvents</strong>: A list of user-to-item events which will 
be treated as <em>seen</em> events. Used when <em>unseenOnly</em> is set to 
true.</li> <li><strong>similarItemEvents</strong>: A list of user-item-item 
events which will be used to find similar items to the items which the user has 
performend these events on.</li> <li><strong>rank</strong>: Parameter of the 
MLlib ALS algorithm. Number of latent features.</li> 
<li><strong>iteration</strong>: Parameter o
 f the MLlib ALS algorithm. Number of iterations.</li> 
<li><strong>lambda</strong>: Regularization parameter of the MLlib ALS 
algorithm.</li> <li><strong>seed</strong>: A random seed of the MLlib ALS 
algorithm.</li> </ul> <h3 id='train(...)' 
class='header-anchors'>train(...)</h3><p><code>train</code> is called when you 
run <strong>pio train</strong>. This is where MLlib ALS algorithm, i.e. 
<code>ALS.trainImplicit()</code>, is used to train a predictive model. In 
addition, we also count the number of items being bought for each item as 
default model which will be used when there is no ALS model available or other 
useful information about the user is available during 
<code>predict</code>.</p><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> <p>Parameter description:</p> <ul> 
<li><strong>appName</strong>: Your App name. Events defined by 
&quot;seenItemEvents&quot; and &quot;similarItemEvents&quot; will be read from 
this app during <code>predict</code>.</li> <li><strong>unseenOnly</strong>: 
true or false. Set to true if you want to recommend unseen items only. Seen 
items are defined by <em>seenItemEvents</em> which mean if the user has these 
events on the items, then it&#39;s treated as <em>seen</em>.</li> 
<li><strong>seenItemEvents</strong>: A list of user-to-item events which will 
be treated as <em>seen</em> events. Used when <em>unseenOnly</em> is set to 
true.</li> <li><strong>similarItemEvents</strong>: A list of user-item-item 
events which will be used to find similar items to the items which the user has 
performed these events on.</li> <li><strong>rank</strong>: Parameter of the 
MLlib ALS algorithm. Number of latent features.</li> 
<li><strong>iteration</strong>: Parameter of 
 the MLlib ALS algorithm. Number of iterations.</li> 
<li><strong>lambda</strong>: Regularization parameter of the MLlib ALS 
algorithm.</li> <li><strong>seed</strong>: A random seed of the MLlib ALS 
algorithm.</li> </ul> <h3 id='train(...)' 
class='header-anchors'>train(...)</h3><p><code>train</code> is called when you 
run <strong>pio train</strong>. This is where MLlib ALS algorithm, i.e. 
<code>ALS.trainImplicit()</code>, is used to train a predictive model. In 
addition, we also count the number of items being bought for each item as 
default model which will be used when there is no ALS model available or other 
useful information about the user is available during 
<code>predict</code>.</p><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/9fe018b6/templates/javaecommercerecommendation/quickstart/index.html
----------------------------------------------------------------------
diff --git a/templates/javaecommercerecommendation/quickstart/index.html 
b/templates/javaecommercerecommendation/quickstart/index.html
index b826675..259f689 100644
--- a/templates/javaecommercerecommendation/quickstart/index.html
+++ b/templates/javaecommercerecommendation/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 training data for this Engine. By default, the E-Commerce 
Recommendation Engine Template supports 2 types of entities and 2 events: 
<strong>user</strong> and <strong>item</strong>; events <strong>view</strong> 
and <strong>buy</strong>. An item has the <strong>categories</strong> property, 
which is a list of category names (String). A user can view and buy an item. 
The specical <strong>constraint</strong> entiy with entityId 
<strong>unavailableItems</strong> defines a list of unavailable items and is 
taken into account in realtime during serving.</p><p>In summary, this template 
requires &#39;$set&#39; user event, &#39;$set&#39; item event, user-view-item 
events, user-buy-item event and &#39;$set&#39; constraint event.</p><div 
class="alert-message info"><p>This template can easily be customized to 
consider other user-to-it
 em events.</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 
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-f2c0c497-f8bd-4487-be43-a10fe4e1cc4b">REST API</a></li> <li 
data-lang="python"><a href="#tab-a5db0129-0913-411e-8893-5fa3c759b46e">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-d6692edb-ad6d-4cb8-8523-f2a2f3bc3ec6">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-f442678c-6f9f-4f82-b6d8-473ffcbe877f">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-762bdfe5-007e-4673-8b96-d0693925ce7d">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-f2c0c497-f8bd-4487-be43-a10fe4e1cc4b"> <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 training data for this Engine. By default, the E-Commerce 
Recommendation Engine Template supports 2 types of entities and 2 events: 
<strong>user</strong> and <strong>item</strong>; events <strong>view</strong> 
and <strong>buy</strong>. An item has the <strong>categories</strong> property, 
which is a list of category names (String). A user can view and buy an item. 
The specical <strong>constraint</strong> entiy with entityId 
<strong>unavailableItems</strong> defines a list of unavailable items and is 
taken into account in realtime during serving.</p><p>In summary, this template 
requires &#39;$set&#39; user event, &#39;$set&#39; item event, user-view-item 
events, user-buy-item event and &#39;$set&#39; constraint event.</p><div 
class="alert-message info"><p>This template can easily be customized to 
consider other user-to-it
 em events.</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 
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-dafdb525-4c9d-4289-b6a7-7276edab05de">REST API</a></li> <li 
data-lang="python"><a href="#tab-28884d63-a3ee-4c67-a8a2-f32814596982">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-e36f20d1-d545-4861-baae-3ff7a9ee8a1f">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-2540ebbc-d5eb-45a3-9ae3-718460357a38">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-c178773f-c876-4dd2-b50c-2c4d7f06f7a9">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-dafdb525-4c9d-4289-b6a7-7276edab05de"> <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-a5db0129-0913-411e-8893-5fa3c759b46e"> <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-28884d63-a3ee-4c67-a8a2-f32814596982"> <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-d6692edb-ad6d-4cb8-8523-f2a2f3bc3ec6"> <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-e36f20d1-d545-4861-baae-3ff7a9ee8a1f"> <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
@@ -119,7 +119,7 @@ Your system is all ready to go.
   <span class="s1">'properties'</span> <span class="o">=&gt;</span> <span 
class="k">array</span><span class="p">(</span><span 
class="s1">'categories'</span> <span class="o">=&gt;</span> <span 
class="k">array</span><span class="p">(</span><span 
class="s1">'&lt;CATEGORY_1&gt;'</span><span class="p">,</span> <span 
class="s1">'&lt;CATEGORY_2&gt;'</span><span class="p">))</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-f442678c-6f9f-4f82-b6d8-473ffcbe877f"> <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-2540ebbc-d5eb-45a3-9ae3-718460357a38"> <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
@@ -136,7 +136,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-762bdfe5-007e-4673-8b96-d0693925ce7d"> <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-c178773f-c876-4dd2-b50c-2c4d7f06f7a9"> <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
@@ -161,7 +161,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. Note that the item is set with categories properties: 
<code>&quot;c1&quot;</code> and <code>&quot;c2&quot;</code>. Run the following 
<code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li 
data-lang="json"><a href="#tab-6da326ff-2ef1-4b6f-be50-79e544cf059e">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-88bdea17-5603-4895-8fd9-0e6530dccdb1">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-2bfc3b06-5af4-46c7-a7d0-160163a53aee">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-8dbbf899-cf2a-4530-bc9a-bc248bfb2f86">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-b4e2a23f-a903-414c-88c5-d5ef1a474b84">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-6da326
 ff-2ef1-4b6f-be50-79e544cf059e"> <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 
&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. Note that the item is set with categories properties: 
<code>&quot;c1&quot;</code> and <code>&quot;c2&quot;</code>. Run the following 
<code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li 
data-lang="json"><a href="#tab-d797148c-66f6-4c1c-9fbf-ae81455eb452">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-96ec9ed3-a6de-4a32-8ebe-8411fdfdbec7">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-3b5d644c-0452-4147-96a5-e80fc9baed61">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-a6f472b4-4545-45ca-9c17-3c9ef9e677e5">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-d7f92076-6d48-4c47-bf28-b1aa2520fbc0">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-d79714
 8c-66f6-4c1c-9fbf-ae81455eb452"> <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
@@ -182,7 +182,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-88bdea17-5603-4895-8fd9-0e6530dccdb1"> <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-96ec9ed3-a6de-4a32-8ebe-8411fdfdbec7"> <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
@@ -201,7 +201,7 @@ Your system is all ready to go.
     <span class="s">"categories"</span> <span class="p">:</span> <span 
class="p">[</span><span class="s">"&lt;CATEGORY_1&gt;"</span><span 
class="p">,</span> <span class="s">"&lt;CATEGORY_2&gt;"</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-2bfc3b06-5af4-46c7-a7d0-160163a53aee"> <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-3b5d644c-0452-4147-96a5-e80fc9baed61"> <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
@@ -218,7 +218,7 @@ Your system is all ready to go.
   <span class="s1">'properties'</span> <span class="o">=&gt;</span> <span 
class="k">array</span><span class="p">(</span><span 
class="s1">'categories'</span> <span class="o">=&gt;</span> <span 
class="k">array</span><span class="p">(</span><span 
class="s1">'&lt;CATEGORY_1&gt;'</span><span class="p">,</span> <span 
class="s1">'&lt;CATEGORY_2&gt;'</span><span class="p">))</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-8dbbf899-cf2a-4530-bc9a-bc248bfb2f86"> <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-a6f472b4-4545-45ca-9c17-3c9ef9e677e5"> <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
@@ -235,7 +235,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-b4e2a23f-a903-414c-88c5-d5ef1a474b84"> <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-d7f92076-6d48-4c47-bf28-b1aa2520fbc0"> <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
@@ -248,7 +248,7 @@ Your system is all ready to go.
   <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="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">"&lt;CATEGORY_1&gt;"</span><span class="o">,</span> <span 
class="s">"&lt;CATEGORY_2&gt;"</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>The properties of 
the <code>user</code> and <code>item</code> can be set, unset, or delete by 
special events <strong>$set</strong>, <strong>$unset</strong> and 
<strong>$delete</strong>. Please refer to <a 
href="/datacollection/eventapi/#note-about-properties">Event API</a> for more 
details of using these events.</p><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-76aa6e11-6b03-4862-8d1a-2861dc81a3f1">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-a90c1ec5-c0ee-41b3-9276-28a9df0824dc">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-773a7156-4400-45d1-a74e-c82fef1ad3ec">PHP 
SDK</a></li> <li data-lang="ruby"><a href="#tab-a30f3fab-7556-4063-a292-df3de7
 25999b">Ruby SDK</a></li> <li data-lang="java"><a 
href="#tab-dfa2d1c5-f5bf-4c8c-9a58-71ec4eb54f1d">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-76aa6e11-6b03-4862-8d1a-2861dc81a3f1"> <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>The properties of 
the <code>user</code> and <code>item</code> can be set, unset, or delete by 
special events <strong>$set</strong>, <strong>$unset</strong> and 
<strong>$delete</strong>. Please refer to <a 
href="/datacollection/eventapi/#note-about-properties">Event API</a> for more 
details of using these events.</p><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-7fe0db51-ab6a-4619-972c-518953370035">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-6eec9a05-7b0b-40cb-b655-83178ed42cf9">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-b38124f3-b67b-4df8-969d-decbc7b26837">PHP 
SDK</a></li> <li data-lang="ruby"><a href="#tab-3d133087-c60e-4fd6-975a-93e3de
 baa9ea">Ruby SDK</a></li> <li data-lang="java"><a 
href="#tab-29ffa79e-0154-45be-9289-d098bbf94fec">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-7fe0db51-ab6a-4619-972c-518953370035"> <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
@@ -267,7 +267,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-a90c1ec5-c0ee-41b3-9276-28a9df0824dc"> <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-6eec9a05-7b0b-40cb-b655-83178ed42cf9"> <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
@@ -284,7 +284,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-773a7156-4400-45d1-a74e-c82fef1ad3ec"> <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-b38124f3-b67b-4df8-969d-decbc7b26837"> <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
@@ -303,7 +303,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-a30f3fab-7556-4063-a292-df3de725999b"> <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-3d133087-c60e-4fd6-975a-93e3debaa9ea"> <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
@@ -322,7 +322,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-dfa2d1c5-f5bf-4c8c-9a58-71ec4eb54f1d"> <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-29ffa79e-0154-45be-9289-d098bbf94fec"> <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
@@ -337,7 +337,7 @@ Your system is all ready to go.
     <span class="o">.</span><span class="na">targetEntityType</span><span 
class="o">(</span><span class="s">"item"</span><span class="o">)</span>
     <span class="o">.</span><span class="na">targetEntityId</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">viewEvent</span><span class="o">);</span>
-</pre></td> </tr></tbody></table> </div> </div> </div> <p>When the user 
&quot;u0&quot; buy item &quot;i0&quot; on time 
<code>2014-11-10T13:00:00.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-ce441f13-c6c4-480c-a347-8549b8bb5bf0">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-6910fb10-7283-4c33-a4cb-9a2acb883dd7">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-4c41e52d-4edd-4558-8b3c-0bb52cdee440">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-ce55929b-1a92-467b-95f6-8b30f45f94ce">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-50d8c8ac-9fab-4f84-942c-a3efbe3e969e">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-ce441f13-c6c4-480c-a347-8549b8bb5bf0"> <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; buy item &quot;i0&quot; on time 
<code>2014-11-10T13:00:00.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-3fdf4096-a36e-42f6-84c0-234e45b916f9">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-f24aab35-3b91-4c3c-82a7-66070a1538fe">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-103a8031-cf42-4c81-9f09-7211993d65ab">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-cc70547e-a201-48ef-a7ba-3297c90a6e8a">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-808e8e2f-9c7b-4ccc-957e-83e40e53400f">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-3fdf4096-a36e-42f6-84c0-234e45b916f9"> <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
@@ -356,7 +356,7 @@ Your system is all ready to go.
   "targetEntityId" : "i0",
   "eventTime" : "2014-11-10T13:00:00.123-08:00"
 }'</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" 
data-lang="python" id="tab-6910fb10-7283-4c33-a4cb-9a2acb883dd7"> <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-f24aab35-3b91-4c3c-82a7-66070a1538fe"> <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
@@ -373,7 +373,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-4c41e52d-4edd-4558-8b3c-0bb52cdee440"> <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-103a8031-cf42-4c81-9f09-7211993d65ab"> <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
@@ -392,7 +392,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-ce55929b-1a92-467b-95f6-8b30f45f94ce"> <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-cc70547e-a201-48ef-a7ba-3297c90a6e8a"> <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
@@ -409,7 +409,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-50d8c8ac-9fab-4f84-942c-a3efbe3e969e"> <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-808e8e2f-9c7b-4ccc-957e-83e40e53400f"> <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
@@ -490,19 +490,19 @@ User u10 buys item i40
 </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 recommend 4 items to user ID &quot;u1&quot;. You send this JSON 
<code>{ &quot;userEntityId&quot;: &quot;u1&quot;, &quot;number&quot;: 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 da
 ta-lang="json"><a href="#tab-ac957b45-1ec9-44b2-8557-6d68c040896b">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-7b894272-b55e-4e2f-9d3e-df5278e9f88b">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-1a64e410-7773-4364-bd2a-fa6200cb6b50">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-737d5efa-24a7-4a74-8d99-0973f5b3c4a9">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-037c91e3-3908-45b3-b2fc-74b1b9d84827">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-ac957b45-1ec9-44b2-8557-6d68c040896b"> <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 recommend 4 items to user ID &quot;u1&quot;. You send this JSON 
<code>{ &quot;userEntityId&quot;: &quot;u1&quot;, &quot;number&quot;: 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 da
 ta-lang="json"><a href="#tab-8b4197b7-d4e1-42f7-84a8-0915be5f1d95">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-01f45411-e577-4680-a8e5-726b7b66965f">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-339a066e-15f3-44ad-8280-956b8209dd6b">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-f7ffcf2b-9e92-47b4-b01f-cfea846eb9c8">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-55b3056f-01d5-4560-8a7c-5ff1785409d4">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-8b4197b7-d4e1-42f7-84a8-0915be5f1d95"> <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">'{ "userEntityId": "u1", "number": 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-7b894272-b55e-4e2f-9d3e-df5278e9f88b"> <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-01f45411-e577-4680-a8e5-726b7b66965f"> <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">"userEntityId"</span><span 
class="p">:</span> <span class="s">"u1"</span><span class="p">,</span> <span 
class="s">"number"</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-1a64e410-7773-4364-bd2a-fa6200cb6b50"> <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-339a066e-15f3-44ad-8280-956b8209dd6b"> <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
@@ -521,7 +521,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-737d5efa-24a7-4a74-8d99-0973f5b3c4a9"> <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-f7ffcf2b-9e92-47b4-b01f-cfea846eb9c8"> <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
@@ -534,7 +534,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">'userEntityId'</span> <span class="o">=&gt;</span> <span 
class="s1">'i1'</span><span class="p">,</span> <span class="s1">'number'</span> 
<span class="o">=&gt;</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-037c91e3-3908-45b3-b2fc-74b1b9d84827"> <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-55b3056f-01d5-4560-8a7c-5ff1785409d4"> <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
@@ -578,7 +578,7 @@ http://localhost:8000/queries.json
     <span class="o">{</span><span class="s2">"itemEntityId"</span>:<span 
class="s2">"i3"</span>,<span 
class="s2">"score"</span>:0.003007015026561692<span class="o">}</span>
   <span class="o">]</span>
 <span class="o">}</span>
-</pre></td></tr></tbody></table> </div> <p><em>MyECommerceRecommendation</em> 
is now running.</p> <div class="alert-message info"><p>To update the model 
periodically with new data, simply set up a cron job to call <code>pio 
train</code> and <code>pio deploy</code>. The engine will continue to serve 
prediction results during the re-train process. After the training is 
completed, <code>pio deploy</code> will automatically shutdown the existing 
engine server and bring up a new process on the same port.</p></div><div 
class="alert-message info"><p><strong>Note that if you import a <em>large</em> 
data set</strong> and the training seems to be taking forever or getting stuck, 
it&#39;s likely that there is not enough executor memory. It&#39;s recommended 
to setup a Spark standalone cluster, you&#39;ll need to specify more driver and 
executor memory when training with a large data set. Please see <a 
href="/resources/faq/#engine-training">FAQ here</a> for instructions.</p></div> 
<h2 id='setti
 ng-constraint-&quot;unavailableitems&quot;' class='header-anchors'>Setting 
constraint &quot;unavailableItems&quot;</h2><p>Now let&#39;s send an item 
constraint &quot;unavailableItems&quot; (replace accessKey with your Access 
Key):</p><div class="alert-message note"><p>You can also use SDK to send this 
event as described in the SDK sample above.</p></div><div class="tabs"> <ul 
class="control"> <li data-lang="json"><a 
href="#tab-d2d60dc7-34ac-403a-8a3d-b073c6e5b84f">REST API</a></li> <li 
data-lang="python"><a href="#tab-976aae3b-00df-4141-8a82-e7446ce6f443">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-2e3c4d7a-b35d-41bd-8967-8fe26b1c2259">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-a80970a1-3921-4553-9d97-02f192f66977">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-e4ed2ce2-6f84-4c85-ba40-4955f5433147">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-d2d60dc7-34ac-403a-8a3d-b073c6e5b84f"> <div class="highlight shell"> 
<table style="borde
 r-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre 
class="lineno">1
+</pre></td></tr></tbody></table> </div> <p><em>MyECommerceRecommendation</em> 
is now running.</p> <div class="alert-message info"><p>To update the model 
periodically with new data, simply set up a cron job to call <code>pio 
train</code> and <code>pio deploy</code>. The engine will continue to serve 
prediction results during the re-train process. After the training is 
completed, <code>pio deploy</code> will automatically shutdown the existing 
engine server and bring up a new process on the same port.</p></div><div 
class="alert-message info"><p><strong>Note that if you import a <em>large</em> 
data set</strong> and the training seems to be taking forever or getting stuck, 
it&#39;s likely that there is not enough executor memory. It&#39;s recommended 
to setup a Spark standalone cluster, you&#39;ll need to specify more driver and 
executor memory when training with a large data set. Please see <a 
href="/resources/faq/#engine-training">FAQ here</a> for instructions.</p></div> 
<h2 id='setti
 ng-constraint-&quot;unavailableitems&quot;' class='header-anchors'>Setting 
constraint &quot;unavailableItems&quot;</h2><p>Now let&#39;s send an item 
constraint &quot;unavailableItems&quot; (replace accessKey with your Access 
Key):</p><div class="alert-message note"><p>You can also use SDK to send this 
event as described in the SDK sample above.</p></div><div class="tabs"> <ul 
class="control"> <li data-lang="json"><a 
href="#tab-c670b315-751b-4453-adf3-e515d3e9d625">REST API</a></li> <li 
data-lang="python"><a href="#tab-a27bd1c7-d526-4398-8c12-3fbb8b92faff">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-42b5bb4d-0cac-4f9f-b60d-860fb1b4c273">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-23cd4ec2-c08c-4421-b5b1-94d4e1e6ad35">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-5d020d20-4209-4357-a8fa-b99b08df14b2">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-c670b315-751b-4453-adf3-e515d3e9d625"> <div class="highlight shell"> 
<table style="borde
 r-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre 
class="lineno">1
 2
 3
 4
@@ -599,7 +599,7 @@ http://localhost:8000/queries.json
   }
   "eventTime" : "2015-02-17T02:11:21.934Z"
 }'</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" 
data-lang="python" id="tab-976aae3b-00df-4141-8a82-e7446ce6f443"> <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-a27bd1c7-d526-4398-8c12-3fbb8b92faff"> <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
@@ -618,7 +618,7 @@ http://localhost:8000/queries.json
     <span class="s">"items"</span> <span class="p">:</span> <span 
class="p">[</span><span class="s">"&lt;ITEM ID1&gt;"</span><span 
class="p">,</span> <span class="s">"&lt;ITEM ID2&gt;"</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-2e3c4d7a-b35d-41bd-8967-8fe26b1c2259"> <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-42b5bb4d-0cac-4f9f-b60d-860fb1b4c273"> <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
@@ -635,7 +635,7 @@ http://localhost:8000/queries.json
   <span class="s1">'properties'</span> <span class="o">=&gt;</span> <span 
class="k">array</span><span class="p">(</span><span class="s1">'items'</span> 
<span class="o">=&gt;</span> <span class="k">array</span><span 
class="p">(</span><span class="s1">'&lt;ITEM ID1&gt;'</span><span 
class="p">,</span> <span class="s1">'&lt;ITEM ID2&gt;'</span><span 
class="p">))</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-a80970a1-3921-4553-9d97-02f192f66977"> <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-23cd4ec2-c08c-4421-b5b1-94d4e1e6ad35"> <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
@@ -650,7 +650,7 @@ http://localhost:8000/queries.json
     <span class="s1">'properties'</span> <span class="o">=&gt;</span> <span 
class="p">{</span> <span class="s1">'items'</span> <span class="o">=&gt;</span> 
<span class="p">[</span><span class="s1">'&lt;ITEM ID1&gt;'</span><span 
class="p">,</span> <span class="s1">'&lt;ITEM ID2&gt;'</span><span 
class="p">]</span> <span class="p">}</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-e4ed2ce2-6f84-4c85-ba40-4955f5433147"> <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-5d020d20-4209-4357-a8fa-b99b08df14b2"> <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/9fe018b6/templates/leadscoring/dase/index.html
----------------------------------------------------------------------
diff --git a/templates/leadscoring/dase/index.html 
b/templates/leadscoring/dase/index.html
index e48dcea..080b271 100644
--- a/templates/leadscoring/dase/index.html
+++ b/templates/leadscoring/dase/index.html
@@ -196,7 +196,7 @@
   <span class="o">}</span>,
   ...
 <span class="o">}</span>
-</pre></td></tr></tbody></table> </div> <p>In <code>readTraining()</code>, 
<code>PEventStore</code> is an object which provides function to access data 
that is collected by PredictionIO Event Server.</p><p>This Lead Scoring Engine 
Template requires &quot;view&quot; and &quot;buy&quot; events with 
<code>sessionId</code> in event 
property.</p><p><code>PEventStore.find(...)</code> specifies the events that 
you want to read. In this case, &quot;user view page&quot; and &quot;user buy 
item&quot; events are read and then each is mapped to tuple of (sessionId, 
event). The event are then &quot;cogrouped&quot; by sessionId to find out the 
information in the session, such as first page view (landing page view), and 
whether the user converts (buy event), to craete a RDD of Session as 
TrainingData:</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>In <code>readTraining()</code>, 
<code>PEventStore</code> is an object which provides function to access data 
that is collected by PredictionIO Event Server.</p><p>This Lead Scoring Engine 
Template requires &quot;view&quot; and &quot;buy&quot; events with 
<code>sessionId</code> in event 
property.</p><p><code>PEventStore.find(...)</code> specifies the events that 
you want to read. In this case, &quot;user view page&quot; and &quot;user buy 
item&quot; events are read and then each is mapped to tuple of (sessionId, 
event). The event are then &quot;cogrouped&quot; by sessionId to find out the 
information in the session, such as first page view (landing page view), and 
whether the user converts (buy event), to create a RDD of Session as 
TrainingData:</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
@@ -226,7 +226,7 @@
   <span class="k">val</span> <span class="n">featureIndex</span><span 
class="k">:</span> <span class="kt">Map</span><span class="o">[</span><span 
class="kt">String</span>, <span class="kt">Int</span><span class="o">],</span>
   <span class="k">val</span> <span 
class="n">featureCategoricalIntMap</span><span class="k">:</span> <span 
class="kt">Map</span><span class="o">[</span><span class="kt">String</span>, 
<span class="kt">Map</span><span class="o">[</span><span 
class="kt">String</span>, <span class="kt">Int</span><span class="o">]]</span>
 <span class="o">)</span> <span class="k">extends</span> <span 
class="nc">Serializable</span>
-</pre></td></tr></tbody></table> </div> <p>The <code>LabeledPoint</code> class 
is defined in Spark MLlib and it&#39;s required for the RandomForest Algorithm. 
The <code>featureIndex</code> is a Map of feature name to the position index in 
the feature vector. <code>featureCategoricalIntMap</code> is a Map of 
categorical feature name to the Map of categorical value map for this 
feature.</p><p>By default, the feature used for classification is 
&quot;landingPage&quot;, &quot;referrer&quot; and &quot;browser&quot;. Since 
these features contain categorical values, we need to create a map of 
categorical values to the integer values for the algorithm to use.</p><div 
class="alert-message note"><p>You can customize the tempate to use other 
features.</p></div><p>For example, if the feature &quot;landingPage&quot; can 
be any of the following values: &quot;page1&quot;, &quot;page2&quot;, 
&quot;page3&quot;, &quot;page4&quot;. We can create a categorical Int value 
Map, such as:</p><div class="high
 light 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 <code>LabeledPoint</code> class 
is defined in Spark MLlib and it&#39;s required for the RandomForest Algorithm. 
The <code>featureIndex</code> is a Map of feature name to the position index in 
the feature vector. <code>featureCategoricalIntMap</code> is a Map of 
categorical feature name to the Map of categorical value map for this 
feature.</p><p>By default, the feature used for classification is 
&quot;landingPage&quot;, &quot;referrer&quot; and &quot;browser&quot;. Since 
these features contain categorical values, we need to create a map of 
categorical values to the integer values for the algorithm to use.</p><div 
class="alert-message note"><p>You can customize the template to use other 
features.</p></div><p>For example, if the feature &quot;landingPage&quot; can 
be any of the following values: &quot;page1&quot;, &quot;page2&quot;, 
&quot;page3&quot;, &quot;page4&quot;. We can create a categorical Int value 
Map, such as:</p><div class="hig
 hlight scala"><table style="border-spacing: 0"><tbody><tr><td class="gutter 
gl" style="text-align: right"><pre class="lineno">1
 2
 3
 4
@@ -237,7 +237,7 @@
   <span class="s">"page3"</span> <span class="o">-&gt;</span> <span 
class="mi">2</span><span class="o">,</span>
   <span class="s">"page4"</span> <span class="o">-&gt;</span> <span 
class="mi">3</span>
 <span class="o">)</span>
-</pre></td></tr></tbody></table> </div> <p>Instead of manually create such 
Map, a helper method <code>createCategoricalIntMap()</code> is defined in 
<strong>Prepraator.scala</strong> for this purpose.</p><p>Each 
<code>labeledPoint</code> is a label and a feature vector. The element index of 
the vector for the coresponding feature is defined by <code>featureIndex</code> 
Map. By default, it&#39;s defined as</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>Instead of manually create such 
Map, a helper method <code>createCategoricalIntMap()</code> is defined in 
<strong>Prepraator.scala</strong> for this purpose.</p><p>Each 
<code>labeledPoint</code> is a label and a feature vector. The element index of 
the vector for the corresponding feature is defined by 
<code>featureIndex</code> Map. By default, it&#39;s defined as</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/9fe018b6/templates/leadscoring/quickstart/index.html
----------------------------------------------------------------------
diff --git a/templates/leadscoring/quickstart/index.html 
b/templates/leadscoring/quickstart/index.html
index 30caf24..cfd78fb 100644
--- a/templates/leadscoring/quickstart/index.html
+++ b/templates/leadscoring/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 training data for this Engine. By default, Lead Scoring 
Engine Template supports the following entities: <strong>user</strong>, 
<strong>page</strong>, and <strong>item</strong>. An user views a page, and 
buys an item.</p><p>Note that a &quot;sessionId&quot; property is required to 
indicate these events happen in the same session. In the first visit of a user, 
you should specify the optional &quot;referrral ID&quot; and 
&quot;browser&quot; information. These are used to determine where the user 
comes from and the browser information.</p><p>In summary, this template 
requires user-view-page event and user-buy-item events with the session ID, 
referrer ID and browser properties.</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 an user with ID u0 views a URL page &quot;example.com/page0&quot; 
on time <code>2014-11-02T09:39:45.618-08:00</code>, with session ID 
&quot;akdj230fj8ass&quot; (current time will be used if eventTime is not 
specified) you can send the event to Event Server. Run the following 
<code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li 
data-lang="json"><a href="#tab-816862ec-a2c3-4f25-
 8c9e-dca6551f2ca0">REST API</a></li> <li data-lang="python"><a 
href="#tab-df5742ac-010a-43ee-baaf-38aa40d4c971">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-77f615c0-a797-4ba0-9ce4-987818d2379d">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-89e415fa-b961-4404-81db-b957e6dac5b3">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-81e14241-c952-4125-aa30-559ba85cd8fe">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-816862ec-a2c3-4f25-8c9e-dca6551f2ca0"> <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 training data for this Engine. By default, Lead Scoring 
Engine Template supports the following entities: <strong>user</strong>, 
<strong>page</strong>, and <strong>item</strong>. An user views a page, and 
buys an item.</p><p>Note that a &quot;sessionId&quot; property is required to 
indicate these events happen in the same session. In the first visit of a user, 
you should specify the optional &quot;referrral ID&quot; and 
&quot;browser&quot; information. These are used to determine where the user 
comes from and the browser information.</p><p>In summary, this template 
requires user-view-page event and user-buy-item events with the session ID, 
referrer ID and browser properties.</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 an user with ID u0 views a URL page &quot;example.com/page0&quot; 
on time <code>2014-11-02T09:39:45.618-08:00</code>, with session ID 
&quot;akdj230fj8ass&quot; (current time will be used if eventTime is not 
specified) you can send the event to Event Server. Run the following 
<code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li 
data-lang="json"><a href="#tab-a8de3ec3-4854-4c59-
 aa3a-4db76764cace">REST API</a></li> <li data-lang="python"><a 
href="#tab-6cbf9eca-a038-474b-9816-3b19453e6582">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-f329c062-f105-453b-822f-e69f1e873b5e">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-907789b4-5b2a-49b0-8696-f96fb796b50b">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-84ab8ae6-6dc0-4227-951a-a31fcbc1d969">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-a8de3ec3-4854-4c59-aa3a-4db76764cace"> <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
@@ -61,7 +61,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-df5742ac-010a-43ee-baaf-38aa40d4c971"> <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-6cbf9eca-a038-474b-9816-3b19453e6582"> <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
@@ -106,7 +106,7 @@ Your system is all ready to go.
     <span class="s">"browser"</span><span class="p">:</span> <span 
class="o">&lt;</span><span class="n">BROWSER</span><span class="o">&gt;</span> 
<span class="c"># optinal. but should specify this if you have this information 
when user views the landing page</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-77f615c0-a797-4ba0-9ce4-987818d2379d"> <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-f329c062-f105-453b-822f-e69f1e873b5e"> <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
@@ -145,7 +145,7 @@ Your system is all ready to go.
   <span class="p">)</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-89e415fa-b961-4404-81db-b957e6dac5b3"> <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-907789b4-5b2a-49b0-8696-f96fb796b50b"> <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
@@ -178,7 +178,7 @@ Your system is all ready to go.
     <span class="p">}</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-81e14241-c952-4125-aa30-559ba85cd8fe"> <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-84ab8ae6-6dc0-4227-951a-a31fcbc1d969"> <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
@@ -213,7 +213,7 @@ Your system is all ready to go.
     <span class="o">.</span><span class="na">property</span><span 
class="o">(</span><span class="s">"referrerId"</span><span class="o">,</span> 
<span class="s">"&lt;REFERRER ID&gt;"</span><span class="o">)</span>
     <span class="o">.</span><span class="na">property</span><span 
class="o">(</span><span class="s">"browser"</span><span class="o">,</span> 
<span class="s">"&lt;BROWSER&gt;"</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">viewEvent</span><span class="o">);</span>
-</pre></td> </tr></tbody></table> </div> </div> </div> <p>In the same browing 
session &quot;akdj230fj8ass&quot;, the user with ID u0 buys an item i0 on time 
<code>2014-11-02T09:42:00.123-08:00</code> (current time will be used if 
eventTime is not specified), you can send the following buy event. Run the 
following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> 
<li data-lang="json"><a href="#tab-c0ee3dd0-6b2d-4bb5-8c9f-505d0c56f12d">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-5ca1ad9a-9f5d-4c2d-95cb-6ced000c15ed">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-7793d2e0-654e-4561-85a9-16d781ca3f9e">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-88fd8335-c787-463b-8f4d-869be75ca54e">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-f858827b-2e13-46ce-9ab6-b80c6c4ab74a">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-c0ee3dd0-6b2d-4bb5-8c9f-505d0c56f12d"> <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>In the same browsing 
session &quot;akdj230fj8ass&quot;, the user with ID u0 buys an item i0 on time 
<code>2014-11-02T09:42:00.123-08:00</code> (current time will be used if 
eventTime is not specified), you can send the following buy event. Run the 
following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> 
<li data-lang="json"><a href="#tab-8132fa02-ef56-422a-af09-43cd5e5e0ff0">REST 
API</a></li> <li data-lang="python"><a 
href="#tab-0896783c-42ce-411f-995b-94dd897bbe0f">Python SDK</a></li> <li 
data-lang="php"><a href="#tab-75438f58-363a-4ca4-af9f-989c18f27f20">PHP 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-c3aa617d-738f-46e5-9bb8-077582232578">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-fcc129ac-7cd5-44a8-951f-0307b6ad1d34">Java 
SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" 
id="tab-8132fa02-ef56-422a-af09-43cd5e5e0ff0"> <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
@@ -238,7 +238,7 @@ Your system is all ready to go.
   }
   "eventTime" : "2014-11-02T09:42:00.123-08:00"
 }'</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" 
data-lang="python" id="tab-5ca1ad9a-9f5d-4c2d-95cb-6ced000c15ed"> <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-0896783c-42ce-411f-995b-94dd897bbe0f"> <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
@@ -261,7 +261,7 @@ Your system is all ready to go.
     <span class="s">"sessionId"</span><span class="p">:</span> <span 
class="o">&lt;</span><span class="n">SESSION</span> <span 
class="n">ID</span><span class="o">&gt;</span><span class="p">,</span> <span 
class="c"># required</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-7793d2e0-654e-4561-85a9-16d781ca3f9e"> <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-75438f58-363a-4ca4-af9f-989c18f27f20"> <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
@@ -288,7 +288,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-88fd8335-c787-463b-8f4d-869be75ca54e"> <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-c3aa617d-738f-46e5-9bb8-077582232578"> <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
@@ -311,7 +311,7 @@ Your system is all ready to go.
     <span class="p">}</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-f858827b-2e13-46ce-9ab6-b80c6c4ab74a"> <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-fcc129ac-7cd5-44a8-951f-0307b6ad1d34"> <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
@@ -371,7 +371,7 @@ User u5 buys item i5
 </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 the 
results. When a user lands on your page &quot;example.com/page9&quot;, with 
referrer &quot;referrer10.com&quot; and browser &quot;Firefox&quot;, you can 
get the predicted lead score by sending this JSON &#39;{ 
&quot;landingPageId&quot; : &quot;example.com/page9&quot;, 
&quot;referrerId&quot; : &quot;referrer10.com&quot;, &quot;browser&quot;: 
&quot;Firefox&quot; }&#39; to the deployed engine. The engine will return a 
JSON with the score.</p><p>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-6fce22da-c8c9-48b2-ad9b-a29e5f8b8374">REST API</a></li> <li 
data-lang="python"><a href="#tab-7141ef5b-dd70-45c9-a79c-92869c21d4bf">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-42827bf0-b420-4799-bc21-88bd886cbe61">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-ab9e6fab-b122-459e-a814-523103cef3c5">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-caa94668-3d00-41af-ac04-fc6a311aaf28">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-6fce22da-c8c9-48b2-ad9b-a29e5f8b8374"> <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 the 
results. When a user lands on your page &quot;example.com/page9&quot;, with 
referrer &quot;referrer10.com&quot; and browser &quot;Firefox&quot;, you can 
get the predicted lead score by sending this JSON &#39;{ 
&quot;landingPageId&quot; : &quot;example.com/page9&quot;, 
&quot;referrerId&quot; : &quot;referrer10.com&quot;, &quot;browser&quot;: 
&quot;Firefox&quot; }&#39; to the deployed engine. The engine will return a 
JSON with the score.</p><p>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-3ecb7252-158a-457c-883f-a59f62fe20c9">REST API</a></li> <li 
data-lang="python"><a href="#tab-614b797a-ad9d-4f6e-b21e-b429496fb763">Python 
SDK</a></li> <li data-lang="php"><a 
href="#tab-f4841e7a-ba7f-45c1-9896-73cf3d47a7a0">PHP SDK</a></li> <li 
data-lang="ruby"><a href="#tab-2d7c9ac1-cbd1-4318-9b58-e64bfe00df7a">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-125f7c00-3457-4eca-9306-6199c4c6fd95">Java SDK</a></li> </ul> <div 
data-tab="REST API" data-lang="json" 
id="tab-3ecb7252-158a-457c-883f-a59f62fe20c9"> <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
@@ -384,7 +384,7 @@ User u5 buys item i5
   "browser": "Firefox" }'</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-7141ef5b-dd70-45c9-a79c-92869c21d4bf"> <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-614b797a-ad9d-4f6e-b21e-b429496fb763"> <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
@@ -397,7 +397,7 @@ http://localhost:8000/queries.json
   <span class="s">"referrerId"</span> <span class="p">:</span> <span 
class="s">"referrer10.com"</span><span class="p">,</span>
   <span class="s">"browser"</span><span class="p">:</span> <span 
class="s">"Firefox"</span>
 <span class="p">})</span>
-</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" 
data-lang="php" id="tab-42827bf0-b420-4799-bc21-88bd886cbe61"> <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-f4841e7a-ba7f-45c1-9896-73cf3d47a7a0"> <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
@@ -426,7 +426,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-ab9e6fab-b122-459e-a814-523103cef3c5"> <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-2d7c9ac1-cbd1-4318-9b58-e64bfe00df7a"> <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
@@ -447,7 +447,7 @@ http://localhost:8000/queries.json
 <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-caa94668-3d00-41af-ac04-fc6a311aaf28"> <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-125f7c00-3457-4eca-9306-6199c4c6fd95"> <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/9fe018b6/templates/productranking/dase/index.html
----------------------------------------------------------------------
diff --git a/templates/productranking/dase/index.html 
b/templates/productranking/dase/index.html
index 14108c0..13f2fc0 100644
--- a/templates/productranking/dase/index.html
+++ b/templates/productranking/dase/index.html
@@ -496,7 +496,7 @@
   <span class="n">numIterations</span><span class="k">:</span> <span 
class="kt">Int</span><span class="o">,</span>
   <span class="n">lambda</span><span class="k">:</span> <span 
class="kt">Double</span><span class="o">,</span>
   <span class="n">seed</span><span class="k">:</span> <span 
class="kt">Option</span><span class="o">[</span><span 
class="kt">Long</span><span class="o">])</span> <span class="k">extends</span> 
<span class="nc">Params</span>
-</pre></td></tr></tbody></table> </div> <p>The <code>seed</code> parameter is 
an optional parameter, which is used by MLlib ALS algorithm internally to 
generate random values. If the <code>seed</code> is not specified, current 
system time would be used and hence each train may produce different reuslts. 
Specify a fixed value for the <code>seed</code> if you want to have 
deterministic result (For example, when you are 
testing).</p><p><code>ALS.trainImplicit()</code> then returns a 
<code>MatrixFactorizationModel</code> model which contains two RDDs: 
userFeatures and productFeatures. They correspond to the user X latent features 
matrix and item X latent features matrix, respectively. In this case, we will 
make use of both userFeatures and productFeatures matrix to rank the items for 
the user. These matrixes are stored as local model. You could see the 
<code>ALSModel</code> class is defined as:</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 <code>seed</code> parameter is 
an optional parameter, which is used by MLlib ALS algorithm internally to 
generate random values. If the <code>seed</code> is not specified, current 
system time would be used and hence each train may produce different results. 
Specify a fixed value for the <code>seed</code> if you want to have 
deterministic result (For example, when you are 
testing).</p><p><code>ALS.trainImplicit()</code> then returns a 
<code>MatrixFactorizationModel</code> model which contains two RDDs: 
userFeatures and productFeatures. They correspond to the user X latent features 
matrix and item X latent features matrix, respectively. In this case, we will 
make use of both userFeatures and productFeatures matrix to rank the items for 
the user. These matrixes are stored as local model. You could see the 
<code>ALSModel</code> class is defined as:</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

Reply via email to