Repository: predictionio-site Updated Branches: refs/heads/asf-site c2a267d34 -> c453559e8
http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c453559e/templates/similarproduct/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/similarproduct/quickstart/index.html b/templates/similarproduct/quickstart/index.html index 6f8e19b..2559101 100644 --- a/templates/similarproduct/quickstart/index.html +++ b/templates/similarproduct/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's collect some training data for the app of this Engine. By default, the Similar Product Engine Template supports 2 types of entities: <strong>user</strong> and <strong>item</strong>, and event <strong>view</strong>. An item has the <strong>categories</strong> property, which is a list of category names (String). A user can view an item. Respectively, this template requires '$set' user event, '$set' item event, and user-view-item events.</p><div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>buy</em>, <em>rate</em> and <em>like</em>.</p></div> <p>You can send these events to PredictionIO Event Server in real-time easily by making a HTTP request or through the provided SDK. Please see <a href="/appintegration/">App Integration Overview</a> for more detai ls how to integrate your app with SDK.</p><p>Let's try sending events to EventServer with the following <code>curl</code> commands (The corresponding SDK code is showed in other tabs).</p><p>Replace <code><ACCCESS_KEY></code> by the Access Key generated in above steps. Note that <code>localhost:7070</code> is the default URL of the Event Server.</p><p>For convenience, set your access key to the shell variable, run:</p><p><code>$ ACCESS_KEY=<ACCESS_KEY></code></p> <p><a href="#"></a></p> <p>For example, when a new user with id "u0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for this user. To send this event, run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-4a83dae8-c274-4786-aebb-c19683e269d2">REST API</a></li> <li data-lang="python"><a href="#tab-f31b62a1-35 9b-4fe1-9864-1df9015f81ff">Python SDK</a></li> <li data-lang="php"><a href="#tab-bd832714-9992-4876-adc8-35f35720ff92">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-c0f2cc6f-7060-4bcf-92cc-737708d6695a">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-35b772be-a555-47ee-ae7e-bed2476bfdd3">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-4a83dae8-c274-4786-aebb-c19683e269d2"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td></tr></tbody></table> </div> <p><a href="#"></a></p> <h2 id='4.-collecting-data' class='header-anchors'>4. Collecting Data</h2><p>Next, let's collect some training data for the app of this Engine. By default, the Similar Product Engine Template supports 2 types of entities: <strong>user</strong> and <strong>item</strong>, and event <strong>view</strong>. An item has the <strong>categories</strong> property, which is a list of category names (String). A user can view an item. Respectively, this template requires '$set' user event, '$set' item event, and user-view-item events.</p><div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>buy</em>, <em>rate</em> and <em>like</em>.</p></div> <p>You can send these events to PredictionIO Event Server in real-time easily by making a HTTP request or through the provided SDK. Please see <a href="/appintegration/">App Integration Overview</a> for more detai ls how to integrate your app with SDK.</p><p>Let's try sending events to EventServer with the following <code>curl</code> commands (The corresponding SDK code is showed in other tabs).</p><p>Replace <code><ACCCESS_KEY></code> by the Access Key generated in above steps. Note that <code>localhost:7070</code> is the default URL of the Event Server.</p><p>For convenience, set your access key to the shell variable, run:</p><p><code>$ ACCESS_KEY=<ACCESS_KEY></code></p> <p><a href="#"></a></p> <p>For example, when a new user with id "u0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for this user. To send this event, run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-9610dc58-0757-4ee1-92a8-3aa9841de65c">REST API</a></li> <li data-lang="python"><a href="#tab-8167e03f-c2 27-4a92-a879-6c010ede04bd">Python SDK</a></li> <li data-lang="php"><a href="#tab-1617b9a8-e648-4b58-a91e-f3f0f09166c8">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-4b1b005a-f626-4874-98f5-aa038ab455cb">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-ecfac765-1251-4b16-b404-106725fb1d75">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-9610dc58-0757-4ee1-92a8-3aa9841de65c"> <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-f31b62a1-359b-4fe1-9864-1df9015f81ff"> <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-8167e03f-c227-4a92-a879-6c010ede04bd"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -86,7 +86,7 @@ Your system is all ready to go. <span class="n">event_time</span><span class="o">=</span><span class="n">datetime</span><span class="p">(</span> <span class="mi">2014</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mo">02</span><span class="p">,</span> <span class="mi">09</span><span class="p">,</span> <span class="mi">39</span><span class="p">,</span> <span class="mi">45</span><span class="p">,</span> <span class="mi">618000</span><span class="p">,</span> <span class="n">pytz</span><span class="o">.</span><span class="n">timezone</span><span class="p">(</span><span class="s">'US/Pacific'</span><span class="p">)</span> <span class="p">)</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-bd832714-9992-4876-adc8-35f35720ff92"> <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-1617b9a8-e648-4b58-a91e-f3f0f09166c8"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -111,7 +111,7 @@ Your system is all ready to go. <span class="s1">'entityId'</span> <span class="o">=></span> <span class="o"><</span><span class="nx">USER</span> <span class="nx">ID</span><span class="o">></span> <span class="p">));</span> <span class="cp">?></span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-c0f2cc6f-7060-4bcf-92cc-737708d6695a"> <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-4b1b005a-f626-4874-98f5-aa038ab455cb"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -128,7 +128,7 @@ Your system is all ready to go. <span class="s1">'user'</span><span class="p">,</span> <span class="o"><</span><span class="no">USER</span> <span class="no">ID</span><span class="o">></span> <span class="p">)</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-35b772be-a555-47ee-ae7e-bed2476bfdd3"> <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-ecfac765-1251-4b16-b404-106725fb1d75"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -153,7 +153,7 @@ Your system is all ready to go. <span class="o">.</span><span class="na">entityType</span><span class="o">(</span><span class="s">"user"</span><span class="o">)</span> <span class="o">.</span><span class="na">entityId</span><span class="o">(<</span><span class="n">USER_ID</span><span class="o">>);</span> <span class="n">client</span><span class="o">.</span><span class="na">createEvent</span><span class="o">(</span><span class="n">userEvent</span><span class="o">);</span> -</pre></td> </tr></tbody></table> </div> </div> </div> <p>When a new item "i0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for the item. Note that the item is set with categories properties: <code>"c1"</code> and <code>"c2"</code>. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-f63dd7e4-3841-49f6-8c5d-165a6020a981">REST API</a></li> <li data-lang="python"><a href="#tab-bd71ffe5-f524-4098-a4a4-d219d7ff796c">Python SDK</a></li> <li data-lang="php"><a href="#tab-6a4d828e-69eb-4850-ac36-7a0bf5c8af51">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-806303ba-8d1a-468e-87b7-936353fc5715">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-b3a7b8a3-8ddc-483a-a76d-c6b427152d7c">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-f63dd7 e4-3841-49f6-8c5d-165a6020a981"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td> </tr></tbody></table> </div> </div> </div> <p>When a new item "i0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for the item. Note that the item is set with categories properties: <code>"c1"</code> and <code>"c2"</code>. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-16fdb46a-972e-497d-b4fc-df9bbd230362">REST API</a></li> <li data-lang="python"><a href="#tab-83cf3128-c224-4a95-bf6c-172e71786a87">Python SDK</a></li> <li data-lang="php"><a href="#tab-565f5749-ca9e-4c3d-812f-eeb802e46611">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-2e668478-0d9e-4398-a11a-666114c6dd05">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-1f809d22-697b-4c4f-96e0-09ae7537d8ef">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-16fdb4 6a-972e-497d-b4fc-df9bbd230362"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -174,7 +174,7 @@ Your system is all ready to go. } "eventTime" : "2014-11-02T09:39:45.618-08:00" }'</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-bd71ffe5-f524-4098-a4a4-d219d7ff796c"> <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-83cf3128-c224-4a95-bf6c-172e71786a87"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -193,7 +193,7 @@ Your system is all ready to go. <span class="s">"categories"</span> <span class="p">:</span> <span class="p">[</span><span class="s">"<CATEGORY_1>"</span><span class="p">,</span> <span class="s">"<CATEGORY_2>"</span><span class="p">]</span> <span class="p">}</span> <span class="p">)</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-6a4d828e-69eb-4850-ac36-7a0bf5c8af51"> <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-565f5749-ca9e-4c3d-812f-eeb802e46611"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -214,7 +214,7 @@ Your system is all ready to go. <span class="p">));</span> <span class="cp">?></span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-806303ba-8d1a-468e-87b7-936353fc5715"> <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-2e668478-0d9e-4398-a11a-666114c6dd05"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -231,7 +231,7 @@ Your system is all ready to go. <span class="p">}</span> <span class="p">)</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-b3a7b8a3-8ddc-483a-a76d-c6b427152d7c"> <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-1f809d22-697b-4c4f-96e0-09ae7537d8ef"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -244,7 +244,7 @@ Your system is all ready to go. <span class="o">.</span><span class="na">entityId</span><span class="o">(<</span><span class="n">ITEM_ID</span><span class="o">>)</span> <span class="o">.</span><span class="na">property</span><span class="o">(</span><span class="s">"categories"</span><span class="o">,</span> <span class="n">ImmutableList</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"<CATEGORY_1>"</span><span class="o">,</span> <span class="s">"<CATEGORY_2>"</span><span class="o">));</span> <span class="n">client</span><span class="o">.</span><span class="na">createEvent</span><span class="o">(</span><span class="n">itemEvent</span><span class="o">)</span> -</pre></td> </tr></tbody></table> </div> </div> </div> <p>When the user "u0" view item "i0" on time <code>2014-11-10T12:34:56.123-08:00</code> (current time will be used if eventTime is not specified), you can send a view event. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-9725ac5d-a2fa-4ddd-a5a9-9f4fb511d6d5">REST API</a></li> <li data-lang="python"><a href="#tab-656f0e9e-8ec6-4c16-8b02-358df424a168">Python SDK</a></li> <li data-lang="php"><a href="#tab-d2832620-ef53-43ec-bec1-44faeddca8f4">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-e4d1ba4f-3542-469b-a826-c1331ab1fbbe">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-6b8fa4db-79ac-41a5-aab5-49ffdfc1adbe">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-9725ac5d-a2fa-4ddd-a5a9-9f4fb511d6d5"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text -align: right"><pre class="lineno">1 +</pre></td> </tr></tbody></table> </div> </div> </div> <p>When the user "u0" view item "i0" on time <code>2014-11-10T12:34:56.123-08:00</code> (current time will be used if eventTime is not specified), you can send a view event. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-1cc8f267-ec44-46f1-b3ec-a0b1e8a7bd9e">REST API</a></li> <li data-lang="python"><a href="#tab-9ff17ba9-b598-4a4e-855b-c043ef05b6a0">Python SDK</a></li> <li data-lang="php"><a href="#tab-4758e879-a380-4d41-8cce-e6c57512d49b">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-203e0c7f-1b94-46fd-b2db-238f39933f64">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-668d6a31-a10f-43f4-ba42-b32f81e19b41">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-1cc8f267-ec44-46f1-b3ec-a0b1e8a7bd9e"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text -align: right"><pre class="lineno">1 2 3 4 @@ -263,7 +263,7 @@ Your system is all ready to go. "targetEntityId" : "i0", "eventTime" : "2014-11-10T12:34:56.123-08:00" }'</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-656f0e9e-8ec6-4c16-8b02-358df424a168"> <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-9ff17ba9-b598-4a4e-855b-c043ef05b6a0"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -280,7 +280,7 @@ Your system is all ready to go. <span class="n">target_entity_type</span><span class="o">=</span><span class="s">"item"</span><span class="p">,</span> <span class="n">target_entity_id</span><span class="o">=<</span><span class="n">ITEM</span> <span class="n">ID</span><span class="o">></span> <span class="p">)</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-d2832620-ef53-43ec-bec1-44faeddca8f4"> <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-4758e879-a380-4d41-8cce-e6c57512d49b"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -299,7 +299,7 @@ Your system is all ready to go. <span class="s1">'targetEntityId'</span> <span class="o">=></span> <span class="o"><</span><span class="nx">ITEM</span> <span class="nx">ID</span><span class="o">></span> <span class="p">));</span> <span class="cp">?></span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-e4d1ba4f-3542-469b-a826-c1331ab1fbbe"> <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-203e0c7f-1b94-46fd-b2db-238f39933f64"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -316,7 +316,7 @@ Your system is all ready to go. <span class="s1">'targetEntityId'</span> <span class="o">=></span> <span class="o"><</span><span class="no">ITEM</span> <span class="no">ID</span><span class="o">></span> <span class="p">}</span> <span class="p">)</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-6b8fa4db-79ac-41a5-aab5-49ffdfc1adbe"> <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-668d6a31-a10f-43f4-ba42-b32f81e19b41"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -376,19 +376,19 @@ User u10 views item i29 </pre></td></tr></tbody></table> </div> <p>When the engine is deployed successfully and running, you should see a console message similar to the following:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1 2</pre></td><td class="code"><pre><span class="o">[</span>INFO] <span class="o">[</span>HttpListener] Bound to /0.0.0.0:8000 <span class="o">[</span>INFO] <span class="o">[</span>MasterActor] Bind successful. Ready to serve. -</pre></td></tr></tbody></table> </div> <p>Do not kill the deployed engine process.</p><p>By default, the deployed engine binds to <a href="http://localhost:8000"><a href="http://localhost:8000">http://localhost:8000</a></a>. You can visit that page in your web browser to check its status.</p><p><img alt="Engine Status" src="/images/engine-server-3246414b.png"/></p></p><h2 id='6.-use-the-engine' class='header-anchors'>6. Use the Engine</h2><p>Now, You can retrieve predicted results. To retrieve 4 items which are similar to item ID "i1". You send this JSON <code>{ "items": ["i1"], "num": 4 }</code> to the deployed engine and it will return a JSON of the recommended items. Simply send a query by making a HTTP request or through the <code>EngineClient</code> of an SDK.</p><p>With the deployed engine running, open another terminal and run the following <code>curl</code> command or use SDK to send the query:</p><div class="tabs"> <ul class="control "> <li data-lang="json"><a href="#tab-bd8c15b9-0b7c-4634-92b4-b5d6f846222e">REST API</a></li> <li data-lang="python"><a href="#tab-ef5a22ef-4a81-4ebe-8ae2-0b689a00fad0">Python SDK</a></li> <li data-lang="php"><a href="#tab-230def69-0802-4337-8b88-118cbc1c80a2">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-7bffac89-a749-412a-b05a-e5e9574243b6">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-a2e869db-d6b9-4f3c-9e51-cfc1c8a0b18a">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-bd8c15b9-0b7c-4634-92b4-b5d6f846222e"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td></tr></tbody></table> </div> <p>Do not kill the deployed engine process.</p><p>By default, the deployed engine binds to <a href="http://localhost:8000"><a href="http://localhost:8000">http://localhost:8000</a></a>. You can visit that page in your web browser to check its status.</p><p><img alt="Engine Status" src="/images/engine-server-3246414b.png"/></p></p><h2 id='6.-use-the-engine' class='header-anchors'>6. Use the Engine</h2><p>Now, You can retrieve predicted results. To retrieve 4 items which are similar to item ID "i1". You send this JSON <code>{ "items": ["i1"], "num": 4 }</code> to the deployed engine and it will return a JSON of the recommended items. Simply send a query by making a HTTP request or through the <code>EngineClient</code> of an SDK.</p><p>With the deployed engine running, open another terminal and run the following <code>curl</code> command or use SDK to send the query:</p><div class="tabs"> <ul class="control "> <li data-lang="json"><a href="#tab-c1e224a7-cc37-4c78-9e62-6486c093f952">REST API</a></li> <li data-lang="python"><a href="#tab-d2339202-295e-488c-ae72-121c427b9400">Python SDK</a></li> <li data-lang="php"><a href="#tab-8631ab92-5231-4dc8-9e51-de8f6c86b1a1">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-4617ded6-053e-4cd6-bbb2-4ba4f1115931">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-3e800eb8-fa50-4f77-bb6d-40efe8ef7e9b">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-c1e224a7-cc37-4c78-9e62-6486c093f952"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4</pre></td> <td class="code"><pre><span class="gp">$ </span>curl -H <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span> -d <span class="s1">'{ "items": ["i1"], "num": 4 }'</span> <span class="se">\</span> http://localhost:8000/queries.json -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-ef5a22ef-4a81-4ebe-8ae2-0b689a00fad0"> <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-d2339202-295e-488c-ae72-121c427b9400"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3</pre></td> <td class="code"><pre><span class="kn">import</span> <span class="nn">predictionio</span> <span class="n">engine_client</span> <span class="o">=</span> <span class="n">predictionio</span><span class="o">.</span><span class="n">EngineClient</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="s">"http://localhost:8000"</span><span class="p">)</span> <span class="k">print</span> <span class="n">engine_client</span><span class="o">.</span><span class="n">send_query</span><span class="p">({</span><span class="s">"items"</span><span class="p">:</span> <span class="p">[</span><span class="s">"i1"</span><span class="p">],</span> <span class="s">"num"</span><span class="p">:</span> <span class="mi">4</span><span class="p">})</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-230def69-0802-4337-8b88-118cbc1c80a2"> <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-8631ab92-5231-4dc8-9e51-de8f6c86b1a1"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -407,7 +407,7 @@ http://localhost:8000/queries.json <span class="nb">print_r</span><span class="p">(</span><span class="nv">$response</span><span class="p">);</span> <span class="cp">?></span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-7bffac89-a749-412a-b05a-e5e9574243b6"> <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-4617ded6-053e-4cd6-bbb2-4ba4f1115931"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -420,7 +420,7 @@ http://localhost:8000/queries.json <span class="n">response</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="nf">send_query</span><span class="p">(</span><span class="s1">'items'</span> <span class="o">=></span> <span class="p">[</span><span class="s1">'i1'</span><span class="p">],</span> <span class="s1">'num'</span> <span class="o">=></span> <span class="mi">4</span><span class="p">)</span> <span class="nb">puts</span> <span class="n">response</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-a2e869db-d6b9-4f3c-9e51-cfc1c8a0b18a"> <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-3e800eb8-fa50-4f77-bb6d-40efe8ef7e9b"> <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 @@ -533,4 +533,4 @@ http://localhost:8000/queries.json e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st'); -_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-eee4bb28.js"></script></body></html> \ No newline at end of file +_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-1a70e440.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c453559e/templates/similarproduct/recommended-user/index.html ---------------------------------------------------------------------- diff --git a/templates/similarproduct/recommended-user/index.html b/templates/similarproduct/recommended-user/index.html index b074ebf..2d5e102 100644 --- a/templates/similarproduct/recommended-user/index.html +++ b/templates/similarproduct/recommended-user/index.html @@ -182,4 +182,4 @@ http://localhost:8000/queries.json e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st'); -_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-eee4bb28.js"></script></body></html> \ No newline at end of file +_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-1a70e440.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c453559e/templates/similarproduct/return-item-properties/index.html ---------------------------------------------------------------------- diff --git a/templates/similarproduct/return-item-properties/index.html b/templates/similarproduct/return-item-properties/index.html index 693fb94..a8894fa 100644 --- a/templates/similarproduct/return-item-properties/index.html +++ b/templates/similarproduct/return-item-properties/index.html @@ -150,4 +150,4 @@ http://localhost:8000/queries.json e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st'); -_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-eee4bb28.js"></script></body></html> \ No newline at end of file +_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-1a70e440.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c453559e/templates/similarproduct/rid-user-set-event/index.html ---------------------------------------------------------------------- diff --git a/templates/similarproduct/rid-user-set-event/index.html b/templates/similarproduct/rid-user-set-event/index.html index ea8dd48..19f8996 100644 --- a/templates/similarproduct/rid-user-set-event/index.html +++ b/templates/similarproduct/rid-user-set-event/index.html @@ -132,4 +132,4 @@ e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st'); -_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-eee4bb28.js"></script></body></html> \ No newline at end of file +_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-1a70e440.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c453559e/templates/similarproduct/train-with-rate-event/index.html ---------------------------------------------------------------------- diff --git a/templates/similarproduct/train-with-rate-event/index.html b/templates/similarproduct/train-with-rate-event/index.html index 3d0280c..d587de0 100644 --- a/templates/similarproduct/train-with-rate-event/index.html +++ b/templates/similarproduct/train-with-rate-event/index.html @@ -252,4 +252,4 @@ e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st'); -_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-eee4bb28.js"></script></body></html> \ No newline at end of file +_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-1a70e440.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c453559e/templates/vanilla/dase/index.html ---------------------------------------------------------------------- diff --git a/templates/vanilla/dase/index.html b/templates/vanilla/dase/index.html index 31985db..e7191f2 100644 --- a/templates/vanilla/dase/index.html +++ b/templates/vanilla/dase/index.html @@ -172,4 +172,4 @@ e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st'); -_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-eee4bb28.js"></script></body></html> \ No newline at end of file +_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-1a70e440.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c453559e/templates/vanilla/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/vanilla/quickstart/index.html b/templates/vanilla/quickstart/index.html index a832067..556ca70 100644 --- a/templates/vanilla/quickstart/index.html +++ b/templates/vanilla/quickstart/index.html @@ -54,17 +54,17 @@ Your system is all ready to go. </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 try to retrieve predicted results. The engine accepts JSON query with the field 'q': <code>{ "q" : "foo" }</code>. A prefix is added to the query data and return as PredictedResult.</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-2540332c-d194-4870-9738-cbc02e480d34">REST API</a></li> <li data-lang="python"><a href="#tab-81ff185a-e84f-43 5e-a9de-cc12265bc038">Python SDK</a></li> <li data-lang="php"><a href="#tab-3a0f3e78-6620-4e3c-bb1a-73ae789d736d">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-a772ca70-55ca-498c-8c8f-8bc119ab598c">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-13156930-f2e2-409e-8357-8e5b03b6d6c8">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-2540332c-d194-4870-9738-cbc02e480d34"> <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 try to retrieve predicted results. The engine accepts JSON query with the field 'q': <code>{ "q" : "foo" }</code>. A prefix is added to the query data and return as PredictedResult.</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-49829ad9-ccb8-4c94-91f9-b5266ebb03cf">REST API</a></li> <li data-lang="python"><a href="#tab-4299758f-82b4-45 f1-8b79-2aee8ab31d79">Python SDK</a></li> <li data-lang="php"><a href="#tab-d3035141-960f-40ed-8296-d2b28dad4795">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-ab3406f5-5c45-487d-a2da-7c182d5da9fc">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-5d6fe781-7425-495a-bbd7-a81082ccb43d">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-49829ad9-ccb8-4c94-91f9-b5266ebb03cf"> <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</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">'{ "q": "foo" }'</span> http://localhost:8000/queries.json -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-81ff185a-e84f-435e-a9de-cc12265bc038"> <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-4299758f-82b4-45f1-8b79-2aee8ab31d79"> <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">"q"</span><span class="p">:</span> <span class="s">"foo"</span> <span class="p">})</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-3a0f3e78-6620-4e3c-bb1a-73ae789d736d"> <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-d3035141-960f-40ed-8296-d2b28dad4795"> <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 @@ -83,7 +83,7 @@ Your system is all ready to go. <span class="nb">print_r</span><span class="p">(</span><span class="nv">$response</span><span class="p">);</span> <span class="cp">?></span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-a772ca70-55ca-498c-8c8f-8bc119ab598c"> <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-ab3406f5-5c45-487d-a2da-7c182d5da9fc"> <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 @@ -96,7 +96,7 @@ Your system is all ready to go. <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">'q'</span> <span class="o">=></span> <span class="s1">'foo'</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-13156930-f2e2-409e-8357-8e5b03b6d6c8"> <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-5d6fe781-7425-495a-bbd7-a81082ccb43d"> <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 @@ -125,4 +125,4 @@ Your system is all ready to go. e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st'); -_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-eee4bb28.js"></script></body></html> \ No newline at end of file +_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-1a70e440.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c453559e/tryit/index.html ---------------------------------------------------------------------- diff --git a/tryit/index.html b/tryit/index.html index b5f1a26..c991588 100644 --- a/tryit/index.html +++ b/tryit/index.html @@ -3,4 +3,4 @@ e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st'); -_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-eee4bb28.js"></script><script src="/javascripts/tryit-e18ad27c.js"></script></body></html> \ No newline at end of file +_st('install','HaUfpXXV87xoB_zzCQ45');</script><script src="/javascripts/application-1a70e440.js"></script><script src="/javascripts/tryit-d34ba011.js"></script></body></html> \ No newline at end of file
