http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/productranking/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/productranking/quickstart/index.html b/templates/productranking/quickstart/index.html index 703eca5..7d9434b 100644 --- a/templates/productranking/quickstart/index.html +++ b/templates/productranking/quickstart/index.html @@ -32,7 +32,7 @@ Your system is all ready to go. <span class="o">[</span>INFO] <span class="o">[</span>App<span class="nv">$]</span> MyApp1 | 1 | 3mZWDzci2D5YsqAnqNnXH9SB6Rg3dsTBs8iHkK6X2i54IQsIZI1eEeQQyMfs7b3F | <span class="o">(</span>all<span class="o">)</span> <span class="o">[</span>INFO] <span class="o">[</span>App<span class="nv">$]</span> MyApp2 | 2 | io5lz6Eg4m3Xe4JZTBFE13GMAf1dhFl6ZteuJfrO84XpdOz9wRCrDU44EUaYuXq5 | <span class="o">(</span>all<span class="o">)</span> <span class="o">[</span>INFO] <span class="o">[</span>App<span class="nv">$]</span> Finished listing 2 app<span class="o">(</span>s<span class="o">)</span>. -</pre></td></tr></tbody></table> </div> <p><a href="#"></a></p> <h2 id='4.-collecting-data' class='header-anchors'>4. Collecting Data</h2><p>Next, let's collect some training data for the app of this Engine. By default, the Product Ranking Engine Template supports 2 types of entities: <strong>user</strong> and <strong>item</strong>, and event <strong>view</strong>. A user can view an item. This template requires '$set' user event, '$set' item event and user-view-item events.</p><p>You can send these events to PredictionIO Event Server in real-time easily by making a HTTP request or through the provided SDK. Please see <a href="/appintegration/">App Integration Overview</a> for more details how to integrate your app with SDK.</p><p>Let'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. N ote 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-456489e8-c37c-45dd-ac14-59480e60efe2">REST API</a></li> <li data-lang="python"><a href="#tab-b29792d4-ff75-4772-9348-c7dbed80813f">Python SDK</a></li> <li data-lang="php"><a href="#tab-14ced709-6820-49dd-a1d8-00208d37fe09">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-5ee9e07a-17e0-4616-bfbf-a1f9d9acdaf5">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-c41d1c32-170b-4eac- ab45-032624d4c47c">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-456489e8-c37c-45dd-ac14-59480e60efe2"> <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 Product Ranking Engine Template supports 2 types of entities: <strong>user</strong> and <strong>item</strong>, and event <strong>view</strong>. A user can view an item. This template requires '$set' user event, '$set' item event and user-view-item events.</p><p>You can send these events to PredictionIO Event Server in real-time easily by making a HTTP request or through the provided SDK. Please see <a href="/appintegration/">App Integration Overview</a> for more details how to integrate your app with SDK.</p><p>Let'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. N ote 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-23fb2501-e913-44f8-9e34-fd7eced5ee05">REST API</a></li> <li data-lang="python"><a href="#tab-f1259157-758f-461d-ab42-ec91037f1807">Python SDK</a></li> <li data-lang="php"><a href="#tab-5c3c7d66-e63b-465d-88f4-33ffc88fbb27">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-ee8859e5-3bdd-4fc2-974f-ba85edfcbbcf">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-b3f48977-2729-4573- 9a20-dedddd8b3b23">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-23fb2501-e913-44f8-9e34-fd7eced5ee05"> <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-b29792d4-ff75-4772-9348-c7dbed80813f"> <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-f1259157-758f-461d-ab42-ec91037f1807"> <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">=<</span><span class="n">USER_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-14ced709-6820-49dd-a1d8-00208d37fe09"> <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-5c3c7d66-e63b-465d-88f4-33ffc88fbb27"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -103,7 +103,7 @@ Your system is all ready to go. <span class="s1">'entityId'</span> <span class="o">=></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-5ee9e07a-17e0-4616-bfbf-a1f9d9acdaf5"> <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-ee8859e5-3bdd-4fc2-974f-ba85edfcbbcf"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -120,7 +120,7 @@ Your system is all ready to go. <span class="s1">'user'</span><span class="p">,</span> <span class="o"><</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-c41d1c32-170b-4eac-ab45-032624d4c47c"> <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-b3f48977-2729-4573-9a20-dedddd8b3b23"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -145,7 +145,7 @@ Your system is all ready to go. <span class="o">.</span><span class="na">entityType</span><span class="o">(</span><span class="s">"user"</span><span class="o">)</span> <span class="o">.</span><span class="na">entityId</span><span class="o">(<</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. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-6c4775f6-5f83-454c-8b06-630c7943cd5d">REST API</a></li> <li data-lang="python"><a href="#tab-65471afd-5737-4699-bc78-fbab6cb08a0f">Python SDK</a></li> <li data-lang="php"><a href="#tab-0439d0e9-8dc0-4b5e-8584-9ae4d105c31f">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-ce56af56-7729-44e0-b51e-778876811dab">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-f4b842fd-3ad6-4b36-9607-20368acf5636">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-6c4775f6-5f83-454c-8b06-630c7943cd5d"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td cla ss="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td> </tr></tbody></table> </div> </div> </div> <p>When a new item "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. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-194961cc-a6ec-485a-877f-8044247c18af">REST API</a></li> <li data-lang="python"><a href="#tab-2e88de52-c74d-4cf7-9b9e-321f2eae7fac">Python SDK</a></li> <li data-lang="php"><a href="#tab-3c759cab-4747-4fad-b72b-d103f268c818">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-90116c9a-1ca7-4243-a30d-e1ba682336bb">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-af9a19ca-2820-477c-8bc6-01e8e08fa611">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-194961cc-a6ec-485a-877f-8044247c18af"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td cla ss="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -160,7 +160,7 @@ Your system is all ready to go. "entityId" : "i0", "eventTime" : "2014-11-02T09:39:45.618-08:00" }'</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-65471afd-5737-4699-bc78-fbab6cb08a0f"> <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-2e88de52-c74d-4cf7-9b9e-321f2eae7fac"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -173,7 +173,7 @@ Your system is all ready to go. <span class="n">entity_type</span><span class="o">=</span><span class="s">"item"</span><span class="p">,</span> <span class="n">entity_id</span><span class="o">=<</span><span class="n">ITEM_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-0439d0e9-8dc0-4b5e-8584-9ae4d105c31f"> <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-3c759cab-4747-4fad-b72b-d103f268c818"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -190,7 +190,7 @@ Your system is all ready to go. <span class="p">));</span> <span class="cp">?></span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-ce56af56-7729-44e0-b51e-778876811dab"> <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-90116c9a-1ca7-4243-a30d-e1ba682336bb"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -203,7 +203,7 @@ Your system is all ready to go. <span class="o"><</span><span class="no">ITEM</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-f4b842fd-3ad6-4b36-9607-20368acf5636"> <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-af9a19ca-2820-477c-8bc6-01e8e08fa611"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -214,7 +214,7 @@ Your system is all ready to go. <span class="o">.</span><span class="na">entityType</span><span class="o">(</span><span class="s">"item"</span><span class="o">)</span> <span class="o">.</span><span class="na">entityId</span><span class="o">(<</span><span class="n">ITEM_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">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-70cc6d0e-4826-4bb3-a62c-ded4a321c1ae">REST API</a></li> <li data-lang="python"><a href="#tab-e32297f9-d07a-45c9-95ca-513866f6a8e7">Python SDK</a></li> <li data-lang="php"><a href="#tab-a83f1ca4-0b77-4b37-8505-d5ddec7b1873">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-6af0582f-fd4f-4924-9027-235c20a9d90a">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-0314b905-0746-446b-a5fd-7fdae60f4d59">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-70cc6d0e-4826-4bb3-a62c-ded4a321c1ae"> <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-26bccac9-d91a-44c0-946b-69e8def2acbd">REST API</a></li> <li data-lang="python"><a href="#tab-d486debb-b1eb-4cb6-8979-6fca259b5cb7">Python SDK</a></li> <li data-lang="php"><a href="#tab-3ccc076b-860b-4843-9deb-0cc577fcabc1">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-97675b20-7bc7-4bc8-a37d-bb27b1b373e4">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-b6bbac16-1458-4582-8449-9866863b3745">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-26bccac9-d91a-44c0-946b-69e8def2acbd"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text -align: right"><pre class="lineno">1 2 3 4 @@ -233,7 +233,7 @@ Your system is all ready to go. "targetEntityId" : "i0", "eventTime" : "2014-11-10T12:34:56.123-08:00" }'</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-e32297f9-d07a-45c9-95ca-513866f6a8e7"> <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-d486debb-b1eb-4cb6-8979-6fca259b5cb7"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -250,7 +250,7 @@ Your system is all ready to go. <span class="n">target_entity_type</span><span class="o">=</span><span class="s">"item"</span><span class="p">,</span> <span class="n">target_entity_id</span><span class="o">=<</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-a83f1ca4-0b77-4b37-8505-d5ddec7b1873"> <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-3ccc076b-860b-4843-9deb-0cc577fcabc1"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -269,7 +269,7 @@ Your system is all ready to go. <span class="s1">'targetEntityId'</span> <span class="o">=></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-6af0582f-fd4f-4924-9027-235c20a9d90a"> <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-97675b20-7bc7-4bc8-a37d-bb27b1b373e4"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -286,7 +286,7 @@ Your system is all ready to go. <span class="s1">'targetEntityId'</span> <span class="o">=></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-0314b905-0746-446b-a5fd-7fdae60f4d59"> <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-b6bbac16-1458-4582-8449-9866863b3745"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -344,14 +344,14 @@ User u10 views item i7 </pre></td></tr></tbody></table> </div> <p>When the engine is deployed successfully and running, you should see a console message similar to the following:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1 2</pre></td><td class="code"><pre><span class="o">[</span>INFO] <span class="o">[</span>HttpListener] Bound to /0.0.0.0:8000 <span class="o">[</span>INFO] <span class="o">[</span>MasterActor] Bind successful. Ready to serve. -</pre></td></tr></tbody></table> </div> <p>Do not kill the deployed engine process.</p><p>By default, the deployed engine binds to <a href="http://localhost:8000"><a href="http://localhost:8000">http://localhost:8000</a></a>. You can visit that page in your web browser to check its status.</p><p><img alt="Engine Status" src="/images/engine-server-3246414b.png"/></p></p><h2 id='6.-use-the-engine' class='header-anchors'>6. Use the Engine</h2><p>Now, You can retrieve predicted results. To rank items with IDs "i1", "i3", "i10", "i2", "i5", "i31", "i9" for user "u2". You send this JSON <code>{ "user": "u2", "items": ["i1", "i3", "i10", "i2", "i5", "i31", "i9"] }</code> to the deployed engine and it will return a JSON of the ranked items. Simply send a query by making a HTTP request or through the <code>EngineCl ient</code> of an SDK.</p><p>With the deployed engine running, open another temrinal 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-69f5ed40-b98d-464f-8859-2d8be754d3d5">REST API</a></li> <li data-lang="python"><a href="#tab-7a567374-8f9d-44c9-beb2-5f1443fdec90">Python SDK</a></li> <li data-lang="php"><a href="#tab-9a306eda-3d48-43fb-8a8f-3e5ee67a1a1a">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-b6759759-0f65-44b5-a8fe-ebcf947eca50">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-35600b58-117a-4283-a696-771c4b6d8cc7">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-69f5ed40-b98d-464f-8859-2d8be754d3d5"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td></tr></tbody></table> </div> <p>Do not kill the deployed engine process.</p><p>By default, the deployed engine binds to <a href="http://localhost:8000"><a href="http://localhost:8000">http://localhost:8000</a></a>. You can visit that page in your web browser to check its status.</p><p><img alt="Engine Status" src="/images/engine-server-3246414b.png"/></p></p><h2 id='6.-use-the-engine' class='header-anchors'>6. Use the Engine</h2><p>Now, You can retrieve predicted results. To rank items with IDs "i1", "i3", "i10", "i2", "i5", "i31", "i9" for user "u2". You send this JSON <code>{ "user": "u2", "items": ["i1", "i3", "i10", "i2", "i5", "i31", "i9"] }</code> to the deployed engine and it will return a JSON of the ranked items. Simply send a query by making a HTTP request or through the <code>EngineCl ient</code> of an SDK.</p><p>With the deployed engine running, open another temrinal 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-f1ab06b0-1d28-405d-8be3-6c0d63b81c6e">REST API</a></li> <li data-lang="python"><a href="#tab-d00e490b-bd71-47ca-a010-5f67184eab5e">Python SDK</a></li> <li data-lang="php"><a href="#tab-b31a9895-1c50-44b2-99dc-2d4163880146">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-2d3c56f2-7cd5-4b5b-a69a-94ea4f8ee103">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-3df8bbd6-72a3-4b3b-8373-245bf578080f">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-f1ab06b0-1d28-405d-8be3-6c0d63b81c6e"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4</pre></td> <td class="code"><pre><span class="gp">$ </span>curl -H <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span> -d <span class="s1">'{ "user": "u2", "items": ["i1", "i3", "i10", "i2", "i5", "i31", "i9"]}'</span> <span class="se">\</span> http://localhost:8000/queries.json -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-7a567374-8f9d-44c9-beb2-5f1443fdec90"> <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-d00e490b-bd71-47ca-a010-5f67184eab5e"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -362,7 +362,7 @@ http://localhost:8000/queries.json <span class="s">"user"</span><span class="p">:</span> <span class="s">"u2"</span><span class="p">,</span> <span class="s">"items"</span><span class="p">:</span> <span class="p">[</span><span class="s">"i1"</span><span class="p">,</span> <span class="s">"i3"</span><span class="p">,</span> <span class="s">"i10"</span><span class="p">,</span> <span class="s">"i2"</span><span class="p">,</span> <span class="s">"i5"</span><span class="p">,</span> <span class="s">"i31"</span><span class="p">,</span> <span class="s">"i9"</span><span class="p">]</span> <span class="p">})</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-9a306eda-3d48-43fb-8a8f-3e5ee67a1a1a"> <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-b31a9895-1c50-44b2-99dc-2d4163880146"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -385,7 +385,7 @@ http://localhost:8000/queries.json <span class="nb">print_r</span><span class="p">(</span><span class="nv">$response</span><span class="p">);</span> <span class="cp">?></span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-b6759759-0f65-44b5-a8fe-ebcf947eca50"> <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-2d3c56f2-7cd5-4b5b-a69a-94ea4f8ee103"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -402,7 +402,7 @@ http://localhost:8000/queries.json <span class="s1">'items'</span> <span class="o">=></span> <span class="p">[</span><span class="s1">'i1'</span><span class="p">,</span> <span class="s1">'i3'</span><span class="p">,</span> <span class="s1">'i10'</span><span class="p">,</span> <span class="s1">'i2'</span><span class="p">,</span> <span class="s1">'i5'</span><span class="p">,</span> <span class="s1">'i31'</span><span class="p">,</span> <span class="s1">'i9'</span><span class="p">])</span> <span class="nb">puts</span> <span class="n">response</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-35600b58-117a-4283-a696-771c4b6d8cc7"> <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-3df8bbd6-72a3-4b3b-8373-245bf578080f"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4
http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/productranking/quickstart/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/productranking/quickstart/index.html.gz b/templates/productranking/quickstart/index.html.gz index 0eb897d..3fe1dc5 100644 Binary files a/templates/productranking/quickstart/index.html.gz and b/templates/productranking/quickstart/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/batch-evaluator/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/batch-evaluator/index.html.gz b/templates/recommendation/batch-evaluator/index.html.gz index ec34435..34efa02 100644 Binary files a/templates/recommendation/batch-evaluator/index.html.gz and b/templates/recommendation/batch-evaluator/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/blacklist-items/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/blacklist-items/index.html.gz b/templates/recommendation/blacklist-items/index.html.gz index 66c9095..626e446 100644 Binary files a/templates/recommendation/blacklist-items/index.html.gz and b/templates/recommendation/blacklist-items/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/customize-data-prep/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/customize-data-prep/index.html.gz b/templates/recommendation/customize-data-prep/index.html.gz index f5d260f..77516c3 100644 Binary files a/templates/recommendation/customize-data-prep/index.html.gz and b/templates/recommendation/customize-data-prep/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/customize-serving/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/customize-serving/index.html.gz b/templates/recommendation/customize-serving/index.html.gz index c6240eb..fc70e67 100644 Binary files a/templates/recommendation/customize-serving/index.html.gz and b/templates/recommendation/customize-serving/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/dase/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/dase/index.html.gz b/templates/recommendation/dase/index.html.gz index ecb5cb2..282ab67 100644 Binary files a/templates/recommendation/dase/index.html.gz and b/templates/recommendation/dase/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/evaluation/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/evaluation/index.html.gz b/templates/recommendation/evaluation/index.html.gz index a9b5951..05ac797 100644 Binary files a/templates/recommendation/evaluation/index.html.gz and b/templates/recommendation/evaluation/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/how-to/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/how-to/index.html.gz b/templates/recommendation/how-to/index.html.gz index a666a30..047d2b7 100644 Binary files a/templates/recommendation/how-to/index.html.gz and b/templates/recommendation/how-to/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/recommendation/quickstart/index.html b/templates/recommendation/quickstart/index.html index c835e77..2d7dc1b 100644 --- a/templates/recommendation/quickstart/index.html +++ b/templates/recommendation/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. By default, the Recommendation Engine Template supports 2 types of events: <strong>rate</strong> and <strong>buy</strong>. A user can give a rating score to an item or he can buy an item. This template requires user-view-item and user-buy-item events.</p><div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>like</em>, <em>dislike</em> etc.</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'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 user with ID "u0" rate an item with ID "i0" with rating of 5 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 the following "rate" event. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-b0b2005b-9802-4a84-aae5-4dd50f8c8060">REST API</a></li> <li data-lang="python"><a href="#tab-b69f77c8-48e8-4a1f-abdf-c1800e424402">Python SDK</a></li> <li data-lang="php"><a href="#tab-07e31dd5-cf42-4ef2-9e38-c27672b55577">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-9be46710-d9fc -4cd7-a2f4-7de49e86e7d2">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-40d143f8-cac1-4d60-814b-88bf7dc34e18">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-b0b2005b-9802-4a84-aae5-4dd50f8c8060"> <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. By default, the Recommendation Engine Template supports 2 types of events: <strong>rate</strong> and <strong>buy</strong>. A user can give a rating score to an item or he can buy an item. This template requires user-view-item and user-buy-item events.</p><div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>like</em>, <em>dislike</em> etc.</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'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 user with ID "u0" rate an item with ID "i0" with rating of 5 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 the following "rate" event. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-c8049f9b-a209-4ddb-acaf-280e4cf51785">REST API</a></li> <li data-lang="python"><a href="#tab-cd1e722a-5534-41e7-b30e-d59f708b8353">Python SDK</a></li> <li data-lang="php"><a href="#tab-ded81bc5-9acf-422c-8ba1-2640cecfc309">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-edb1535f-2590 -433d-83ac-3026d75380ab">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-9e36a511-c0a1-4e00-aca8-00fd7641f744">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-c8049f9b-a209-4ddb-acaf-280e4cf51785"> <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 @@ -57,7 +57,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-b69f77c8-48e8-4a1f-abdf-c1800e424402"> <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-cd1e722a-5534-41e7-b30e-d59f708b8353"> <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 @@ -92,7 +92,7 @@ Your system is all ready to go. <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> <span class="n">properties</span><span class="o">=</span> <span class="p">{</span> <span class="s">"rating"</span> <span class="p">:</span> <span class="nb">float</span><span class="p">(</span><span class="o"><</span><span class="n">RATING</span><span class="o">></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-07e31dd5-cf42-4ef2-9e38-c27672b55577"> <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-ded81bc5-9acf-422c-8ba1-2640cecfc309"> <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 @@ -123,7 +123,7 @@ Your system is all ready to go. <span class="s1">'properties'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span><span class="s1">'rating'</span><span class="o">=></span> <span class="o"><</span><span class="nx">RATING</span><span class="o">></span><span class="p">)</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-9be46710-d9fc-4cd7-a2f4-7de49e86e7d2"> <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-edb1535f-2590-433d-83ac-3026d75380ab"> <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 @@ -150,7 +150,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-40d143f8-cac1-4d60-814b-88bf7dc34e18"> <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-9e36a511-c0a1-4e00-aca8-00fd7641f744"> <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 @@ -179,7 +179,7 @@ Your system is all ready to go. <span class="o">.</span><span class="na">property</span><span class="o">(</span><span class="s">"rating"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Float</span><span class="o">(<</span><span class="n">RATING</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">rateEvent</span><span class="o">);</span> -</pre></td> </tr></tbody></table> </div> </div> </div> <p>When a user with ID "u1" buy an item with ID "i2" 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 the following "rate" event. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-ef1565af-86b9-49ef-a731-7c22092146f7">REST API</a></li> <li data-lang="python"><a href="#tab-f31101bd-4362-40c0-b0c1-b73827613844">Python SDK</a></li> <li data-lang="php"><a href="#tab-0a4020d5-25f3-4ae5-8f59-0db6fa823d47">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-731c9e0b-e0fb-4501-ae68-49a9b3399d5f">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-62a1ba50-e515-4251-a53f-fafa82f235a4">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-ef1565af-86b9-49ef-a731-7c22092146f7"> <div class="highlight shell"> <table style="border-spacing: 0"><tbod y><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td> </tr></tbody></table> </div> </div> </div> <p>When a user with ID "u1" buy an item with ID "i2" 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 the following "rate" event. Run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-000ebfb8-8d04-4689-ae10-4b36b591798a">REST API</a></li> <li data-lang="python"><a href="#tab-2314797b-802c-4427-9f72-bda85ebe040f">Python SDK</a></li> <li data-lang="php"><a href="#tab-6f688bfe-fdba-45cc-b4b3-33500d6857e3">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-346cbca2-9b0a-4a1b-9a9e-549cbddc623d">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-bed1582b-9b14-4f6b-bdd2-cd7b799b6971">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-000ebfb8-8d04-4689-ae10-4b36b591798a"> <div class="highlight shell"> <table style="border-spacing: 0"><tbod y><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -198,7 +198,7 @@ Your system is all ready to go. "targetEntityId" : "i2", "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-f31101bd-4362-40c0-b0c1-b73827613844"> <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-2314797b-802c-4427-9f72-bda85ebe040f"> <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 @@ -213,7 +213,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-0a4020d5-25f3-4ae5-8f59-0db6fa823d47"> <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-6f688bfe-fdba-45cc-b4b3-33500d6857e3"> <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 @@ -232,7 +232,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-731c9e0b-e0fb-4501-ae68-49a9b3399d5f"> <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-346cbca2-9b0a-4a1b-9a9e-549cbddc623d"> <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 @@ -249,7 +249,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-62a1ba50-e515-4251-a53f-fafa82f235a4"> <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-bed1582b-9b14-4f6b-bdd2-cd7b799b6971"> <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 @@ -297,17 +297,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. To recommend 4 movies to user whose id is 1, you send this JSON <code>{ "user": "1", "num": 4 }</code> to the deployed engine and it will return a JSON of the recommended movies. 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 temrinal 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-65c99d7c-9c58-44c5-bd94-109d7f3563d7">REST API</a></li> <li data-lang="python"><a href="#tab-c67a2a01-356e-4d4f-9790-f163553efb2c">Python SDK</a></li> <li data-lang="php"><a href="#tab-effc9e14-d07a-48ac-8518-b9b70d5cb399">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-7778efcf-7ce3-47c0-9111-d28fc5b9fa0a">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-a41f5912-c686-41f6-ba29-594040504d29">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-65c99d7c-9c58-44c5-bd94-109d7f3563d7"> <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. To recommend 4 movies to user whose id is 1, you send this JSON <code>{ "user": "1", "num": 4 }</code> to the deployed engine and it will return a JSON of the recommended movies. 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 temrinal 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-4fc71466-a55d-4fd4-988a-c6e21b35f569">REST API</a></li> <li data-lang="python"><a href="#tab-82932c18-d005-429d-a530-4e9d1ef51894">Python SDK</a></li> <li data-lang="php"><a href="#tab-5f45fe1f-6ce7-47b1-a9f0-036b09b43e3a">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-58f4c467-bd72-4789-ae11-007621501460">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-79cebdf0-0c06-44eb-adaf-c06564d9c891">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-4fc71466-a55d-4fd4-988a-c6e21b35f569"> <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">'{ "user": "1", "num": 4 }'</span> http://localhost:8000/queries.json -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-c67a2a01-356e-4d4f-9790-f163553efb2c"> <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-82932c18-d005-429d-a530-4e9d1ef51894"> <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">"user"</span><span class="p">:</span> <span class="s">"1"</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-effc9e14-d07a-48ac-8518-b9b70d5cb399"> <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-5f45fe1f-6ce7-47b1-a9f0-036b09b43e3a"> <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 @@ -326,7 +326,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-7778efcf-7ce3-47c0-9111-d28fc5b9fa0a"> <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-58f4c467-bd72-4789-ae11-007621501460"> <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 @@ -339,7 +339,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">'user'</span> <span class="o">=></span> <span class="o"><</span><span class="no">USER</span> <span class="no">ID</span><span class="o">></span><span class="p">,</span> <span class="s1">'num'</span> <span class="o">=></span> <span class="o"><</span><span class="no">NUMBER</span> <span class="p">(</span><span class="n">integer</span><span class="p">)</span><span class="o">></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-a41f5912-c686-41f6-ba29-594040504d29"> <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-79cebdf0-0c06-44eb-adaf-c06564d9c891"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/quickstart/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/quickstart/index.html.gz b/templates/recommendation/quickstart/index.html.gz index d347ee2..5583c4a 100644 Binary files a/templates/recommendation/quickstart/index.html.gz and b/templates/recommendation/quickstart/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/reading-custom-events/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/reading-custom-events/index.html.gz b/templates/recommendation/reading-custom-events/index.html.gz index 259a1f3..3f01b06 100644 Binary files a/templates/recommendation/reading-custom-events/index.html.gz and b/templates/recommendation/reading-custom-events/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/recommendation/training-with-implicit-preference/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/recommendation/training-with-implicit-preference/index.html.gz b/templates/recommendation/training-with-implicit-preference/index.html.gz index 89a1909..9cda982 100644 Binary files a/templates/recommendation/training-with-implicit-preference/index.html.gz and b/templates/recommendation/training-with-implicit-preference/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/similarproduct/dase/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/similarproduct/dase/index.html.gz b/templates/similarproduct/dase/index.html.gz index 5daad86..5605562 100644 Binary files a/templates/similarproduct/dase/index.html.gz and b/templates/similarproduct/dase/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/similarproduct/how-to/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/similarproduct/how-to/index.html.gz b/templates/similarproduct/how-to/index.html.gz index cad157f..cf526a7 100644 Binary files a/templates/similarproduct/how-to/index.html.gz and b/templates/similarproduct/how-to/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/similarproduct/multi-events-multi-algos/index.html.gz ---------------------------------------------------------------------- diff --git a/templates/similarproduct/multi-events-multi-algos/index.html.gz b/templates/similarproduct/multi-events-multi-algos/index.html.gz index 6e61633..6a15e7c 100644 Binary files a/templates/similarproduct/multi-events-multi-algos/index.html.gz and b/templates/similarproduct/multi-events-multi-algos/index.html.gz differ http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4d7436d7/templates/similarproduct/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/similarproduct/quickstart/index.html b/templates/similarproduct/quickstart/index.html index d943daa..c83ec04 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 detail s how to integrate your app with SDK.</p><p>Let's try sending events to EventServer with the following <code>curl</code> commands (The corresponding SDK code is showed in other tabs).</p><p>Replace <code><ACCCESS_KEY></code> by the Access Key generated in above steps. Note that <code>localhost:7070</code> is the default URL of the Event Server.</p><p>For convenience, set your access key to the shell variable, run:</p><p><code>$ ACCESS_KEY=<ACCESS_KEY></code></p> <p><a href="#"></a></p> <p>For example, when a new user with id "u0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for this user. To send this event, run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-10eafc1f-1ba4-4d3c-8f46-5e3e73ee838a">REST API</a></li> <li data-lang="python"><a href="#tab-57339b12-344 3-4738-a251-98c633b1b89a">Python SDK</a></li> <li data-lang="php"><a href="#tab-bccc5db7-a3a4-464a-8e3d-b1516d09a043">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-cf75a11d-3932-4be6-bed6-2470a1a92367">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-a20159c4-73df-498a-964c-a81a2000b848">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-10eafc1f-1ba4-4d3c-8f46-5e3e73ee838a"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td></tr></tbody></table> </div> <p><a href="#"></a></p> <h2 id='4.-collecting-data' class='header-anchors'>4. Collecting Data</h2><p>Next, let's collect some training data for the app of this Engine. By default, the Similar Product Engine Template supports 2 types of entities: <strong>user</strong> and <strong>item</strong>, and event <strong>view</strong>. An item has the <strong>categories</strong> property, which is a list of category names (String). A user can view an item. Respectively, this template requires '$set' user event, '$set' item event, and user-view-item events.</p><div class="alert-message info"><p>This template can easily be customized to consider more user events such as <em>buy</em>, <em>rate</em> and <em>like</em>.</p></div><p>You can send these events to PredictionIO Event Server in real-time easily by making a HTTP request or through the provided SDK. Please see <a href="/appintegration/">App Integration Overview</a> for more detail s how to integrate your app with SDK.</p><p>Let's try sending events to EventServer with the following <code>curl</code> commands (The corresponding SDK code is showed in other tabs).</p><p>Replace <code><ACCCESS_KEY></code> by the Access Key generated in above steps. Note that <code>localhost:7070</code> is the default URL of the Event Server.</p><p>For convenience, set your access key to the shell variable, run:</p><p><code>$ ACCESS_KEY=<ACCESS_KEY></code></p> <p><a href="#"></a></p> <p>For example, when a new user with id "u0" is created in your app on time <code>2014-11-02T09:39:45.618-08:00</code> (current time will be used if eventTime is not specified), you can send a <code>$set</code> event for this user. To send this event, run the following <code>curl</code> command:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-3e6bd731-552f-4423-91bd-678c7cb1257d">REST API</a></li> <li data-lang="python"><a href="#tab-617d3a90-c83 c-4603-8b41-21d9395a5817">Python SDK</a></li> <li data-lang="php"><a href="#tab-88dc50b5-c1bf-4eb6-ad46-bd10f0acbf1f">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-d1e79619-574d-46f8-bbf7-2cdc84345efa">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-7828c930-54dc-4463-a1ef-7ab89129929a">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-3e6bd731-552f-4423-91bd-678c7cb1257d"> <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-57339b12-3443-4738-a251-98c633b1b89a"> <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-617d3a90-c83c-4603-8b41-21d9395a5817"> <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-bccc5db7-a3a4-464a-8e3d-b1516d09a043"> <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-88dc50b5-c1bf-4eb6-ad46-bd10f0acbf1f"> <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-cf75a11d-3932-4be6-bed6-2470a1a92367"> <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-d1e79619-574d-46f8-bbf7-2cdc84345efa"> <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-a20159c4-73df-498a-964c-a81a2000b848"> <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-7828c930-54dc-4463-a1ef-7ab89129929a"> <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-296c70ce-4355-4ef6-9632-161353c82012">REST API</a></li> <li data-lang="python"><a href="#tab-8c3223e4-d4c5-43eb-aa0b-adf442fd6fb7">Python SDK</a></li> <li data-lang="php"><a href="#tab-a0316714-f2f4-4dc1-9bcd-bff93ff92a03">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-88dc6078-97c6-4350-8f7f-295387da6c8e">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-37baf694-205d-418e-9fd2-9cfde294322b">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-296c70 ce-4355-4ef6-9632-161353c82012"> <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-0e752573-c0f4-4953-88e2-e46fdb9428e0">REST API</a></li> <li data-lang="python"><a href="#tab-c7144240-afbe-4793-998e-2d8a1e841e40">Python SDK</a></li> <li data-lang="php"><a href="#tab-f9921b2d-5ab3-45b7-943a-072fd4a9322c">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-2f0d6096-3d5e-4831-8ea8-30d860b547b5">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-5f10d5e4-0e98-4245-8685-a81f06d50ee8">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-0e7525 73-c0f4-4953-88e2-e46fdb9428e0"> <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-8c3223e4-d4c5-43eb-aa0b-adf442fd6fb7"> <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-c7144240-afbe-4793-998e-2d8a1e841e40"> <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-a0316714-f2f4-4dc1-9bcd-bff93ff92a03"> <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-f9921b2d-5ab3-45b7-943a-072fd4a9322c"> <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-88dc6078-97c6-4350-8f7f-295387da6c8e"> <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-2f0d6096-3d5e-4831-8ea8-30d860b547b5"> <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-37baf694-205d-418e-9fd2-9cfde294322b"> <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-5f10d5e4-0e98-4245-8685-a81f06d50ee8"> <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-64052a0d-6ae2-40a8-a2c5-c6108988a192">REST API</a></li> <li data-lang="python"><a href="#tab-7e10bd6b-6e01-4b23-a09c-979af5031c4f">Python SDK</a></li> <li data-lang="php"><a href="#tab-ac9f8718-13ff-4b92-a588-9fd8849142a8">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-4403f051-2c50-46cd-b435-f5534dc6fa9d">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-7679b9cc-397b-4711-b219-ed0cc8aeefb5">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-64052a0d-6ae2-40a8-a2c5-c6108988a192"> <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-51907dc3-0d79-44d2-bac1-e63121ce27a8">REST API</a></li> <li data-lang="python"><a href="#tab-b8c8c24f-29b2-43e0-ac7b-b51dfcb8f7fa">Python SDK</a></li> <li data-lang="php"><a href="#tab-d85edd5b-c2b1-4a81-8b8a-9c698d69a5b8">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-6f72d4c5-a39b-49c8-97a9-9d20a42cda54">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-8e668644-d6e4-41c2-b505-f600f8581029">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-51907dc3-0d79-44d2-bac1-e63121ce27a8"> <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-7e10bd6b-6e01-4b23-a09c-979af5031c4f"> <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-b8c8c24f-29b2-43e0-ac7b-b51dfcb8f7fa"> <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-ac9f8718-13ff-4b92-a588-9fd8849142a8"> <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-d85edd5b-c2b1-4a81-8b8a-9c698d69a5b8"> <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-4403f051-2c50-46cd-b435-f5534dc6fa9d"> <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-6f72d4c5-a39b-49c8-97a9-9d20a42cda54"> <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-7679b9cc-397b-4711-b219-ed0cc8aeefb5"> <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-8e668644-d6e4-41c2-b505-f600f8581029"> <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 temrinal 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-076941cf-de8b-4489-9144-3e63405cba81">REST API</a></li> <li data-lang="python"><a href="#tab-e00576d1-f797-42f1-83a8-b8e981ed800f">Python SDK</a></li> <li data-lang="php"><a href="#tab-09d5249d-0a0a-42e4-97fe-ce85ff1b3a8a">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-85e76934-fd30-44a0-af36-b4fe07b6799c">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-31446f73-e928-4719-b979-c34c59fd9fb6">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-076941cf-de8b-4489-9144-3e63405cba81"> <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 temrinal 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-33150d88-3bb5-40e8-b101-64b5e54ababa">REST API</a></li> <li data-lang="python"><a href="#tab-b0924575-6a8d-4cbb-b710-ec00b4f25ea9">Python SDK</a></li> <li data-lang="php"><a href="#tab-b034fd1b-61b3-4886-8ae8-eee1acf8b141">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-79d94bb9-24aa-47c0-9feb-59ad824f5e0d">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-8c6a4191-7377-42b4-b82d-93dcedf2caf7">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-33150d88-3bb5-40e8-b101-64b5e54ababa"> <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-e00576d1-f797-42f1-83a8-b8e981ed800f"> <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-b0924575-6a8d-4cbb-b710-ec00b4f25ea9"> <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-09d5249d-0a0a-42e4-97fe-ce85ff1b3a8a"> <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-b034fd1b-61b3-4886-8ae8-eee1acf8b141"> <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-85e76934-fd30-44a0-af36-b4fe07b6799c"> <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-79d94bb9-24aa-47c0-9feb-59ad824f5e0d"> <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-31446f73-e928-4719-b979-c34c59fd9fb6"> <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-8c6a4191-7377-42b4-b82d-93dcedf2caf7"> <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
