Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EE9C3200D44 for ; Mon, 20 Nov 2017 08:38:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id ECDCF160C0E; Mon, 20 Nov 2017 07:38:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C1D99160BEC for ; Mon, 20 Nov 2017 08:38:02 +0100 (CET) Received: (qmail 17257 invoked by uid 500); 20 Nov 2017 07:38:01 -0000 Mailing-List: contact commits-help@predictionio.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@predictionio.apache.org Delivered-To: mailing list commits@predictionio.apache.org Received: (qmail 17248 invoked by uid 99); 20 Nov 2017 07:38:01 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2017 07:38:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id B48A11A20E9 for ; Mon, 20 Nov 2017 07:38:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.722 X-Spam-Level: X-Spam-Status: No, score=-2.722 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_NUMSUBJECT=0.5, MANY_SPAN_IN_TEXT=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id Ggp9wVovBnAe for ; Mon, 20 Nov 2017 07:37:48 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id EAAB15FE5C for ; Mon, 20 Nov 2017 07:37:46 +0000 (UTC) Received: (qmail 16922 invoked by uid 99); 20 Nov 2017 07:37:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2017 07:37:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C79D9F16C2; Mon, 20 Nov 2017 07:37:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: git-site-role@apache.org To: commits@predictionio.incubator.apache.org Date: Mon, 20 Nov 2017 07:37:47 -0000 Message-Id: <63399a09a73541a5b0c05ef9d608996a@git.apache.org> In-Reply-To: <4d043558e3b94f679e34ea19c46aa07f@git.apache.org> References: <4d043558e3b94f679e34ea19c46aa07f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/12] incubator-predictionio-site git commit: Documentation based on apache/incubator-predictionio#865d24cb4838dc30d0fa746e8e17823adf1c2de4 archived-at: Mon, 20 Nov 2017 07:38:05 -0000 http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/complementarypurchase/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/complementarypurchase/quickstart/index.html b/templates/complementarypurchase/quickstart/index.html index 122cf7d..6e54b7b 100644 --- a/templates/complementarypurchase/quickstart/index.html +++ b/templates/complementarypurchase/quickstart/index.html @@ -32,7 +32,7 @@ Your system is all ready to go. [INFO] [App$] MyApp1 | 1 | 3mZWDzci2D5YsqAnqNnXH9SB6Rg3dsTBs8iHkK6X2i54IQsIZI1eEeQQyMfs7b3F | (all) [INFO] [App$] MyApp2 | 2 | io5lz6Eg4m3Xe4JZTBFE13GMAf1dhFl6ZteuJfrO84XpdOz9wRCrDU44EUaYuXq5 | (all) [INFO] [App$] Finished listing 2 app(s). -

4. Collecting Data

Next, let's collect training data for this Engine. By default, Complementary Purchase Engine Template supports the following entities: user, item. A user buys an item. This template requires user-buy-item events.

Note that the engine requires correct buy event time being used in order to determine if the items being bought are in the same 'basket', which is configured by the 'basketWindow' parameter. Using an unreal event time for the buy events will cause an incorrect model. If you use SDK, the current time is used as event time by default.

In particular, make sure correct event time is specified if you import data in batch (i.e. not in real time). If the event time is omitted, the SDK will use current time as event time which is not the actual time of the buy event in this case!

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 App Integration Overview for more details how to integrate your app with SDK.

Let's try sending events to EventServer with the following curl commands (The corresponding SDK code is showed in other tabs).

Replace <ACCCESS_KEY> by the Access Key generated in above steps. Note that localhost:7070 is the default URL of the Event Server.

For convenience, set your access key to the shell variable, run:

$ ACCESS_KEY=<ACCESS_KEY>

When an user u0 buys item i0 on time 2014-11-02T09:39:45.618-08:00 (current time will be used if eventTime is not specified), you can send a buy event. Run the following curl command:

1
+

4. Collecting Data

Next, let's collect training data for this Engine. By default, Complementary Purchase Engine Template supports the following entities: user, item. A user buys an item. This template requires user-buy-item events.

Note that the engine requires correct buy event time being used in order to determine if the items being bought are in the same 'basket', which is configured by the 'basketWindow' parameter. Using an unreal event time for the buy events will cause an incorrect model. If you use SDK, the current time is used as event time by default.

In particular, make sure correct event time is specified if you import data in batch (i.e. not in real time). If the event time is omitted, the SDK will use current time as event time which is not the actual time of the buy event in this case!

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 App Integration Overview for more details how to integrate your app with SDK.

Let's try sending events to EventServer with the following curl commands (The corresponding SDK code is showed in other tabs).

Replace <ACCCESS_KEY> by the Access Key generated in above steps. Note that localhost:7070 is the default URL of the Event Server.

For convenience, set your access key to the shell variable, run:

$ ACCESS_KEY=<ACCESS_KEY>

When an user u0 buys item i0 on time 2014-11-02T09:39:45.618-08:00 (current time will be used if eventTime is not specified), you can send a buy event. Run the following curl command:

1
 2
 3
 4
@@ -51,7 +51,7 @@ Your system is all ready to go.
   "targetEntityId" : "i0",
   "eventTime" : "2014-11-02T09:39:45.618-08:00"
 }'
-
1
+
1
 2
 3
 4
@@ -104,7 +104,7 @@ Your system is all ready to go.
   target_entity_id=<ITEM ID>,
   event_time=<EVENT_TIME>
 )
-
1
+
1
 2
 3
 4
@@ -155,7 +155,7 @@ Your system is all ready to go.
 ));
 
 ?>
-
1
+
1
 2
 3
 4
@@ -200,7 +200,7 @@ Your system is all ready to go.
     'eventTime' => <EVENT_TIME>
   }
 )
-
1
+
1
 2
 3
 4
@@ -290,7 +290,7 @@ User u10 buys item s2i1 at 2014-10-19 15:43:15.618000-07:53
 

When the engine is deployed successfully and running, you should see a console message similar to the following:

1
 2
[INFO] [HttpListener] Bound to /0.0.0.0:8000
 [INFO] [MasterActor] Bind successful. Ready to serve.
-

Do not kill the deployed engine process.

By default, the deployed engine binds to http://localhost:8000. You can visit that page in your web browser to check its status.

Engine Status

6. Use the Engine

Now, You can query the engine. For example, return top 3 items which are frequently bought with item "s2i1". You can sending this JSON '{ "items" : ["s2i1"], "num" : 3 }' to the deployed engine. The engine will return a JSON with the recommeded items.

If you include one or more items in the query, the engine will use each combination of the query items as condition, and return recommended items if there is any for this condition. For example, if you query items are ["A", "B&qu ot;], then the engine will use ["A"], ["B"], and ["A", "B"] as condition and try to find top n recommended items for each combination.

You can simply send a query by making a HTTP request or through the EngineClient of an SDK.

With the deployed engine running, open another terminal and run the following curl command or use SDK to send the query:

1
+

Do not kill the deployed engine process.

By default, the deployed engine binds to http://localhost:8000. You can visit that page in your web browser to check its status.

Engine Status

6. Use the Engine

Now, You can query the engine. For example, return top 3 items which are frequently bought with item "s2i1". You can sending this JSON '{ "items" : ["s2i1"], "num" : 3 }' to the deployed engine. The engine will return a JSON with the recommeded items.

If you include one or more items in the query, the engine will use each combination of the query items as condition, and return recommended items if there is any for this condition. For example, if you query items are ["A", "B&qu ot;], then the engine will use ["A"], ["B"], and ["A", "B"] as condition and try to find top n recommended items for each combination.

You can simply send a query by making a HTTP request or through the EngineClient of an SDK.

With the deployed engine running, open another terminal and run the following curl command or use SDK to send the query:

1
 2
 3
 4
@@ -303,7 +303,7 @@ User u10 buys item s2i1 at 2014-10-19 15:43:15.618000-07:53
 }' \
 http://localhost:8000/queries.json
 
-
1
+
1
 2
 3
 4
@@ -314,7 +314,7 @@ http://localhost:8000/queries.json
   "items" : ["s2i1"],
   "num" : 3
 })
-
1
+
1
 2
 3
 4
@@ -341,7 +341,7 @@ http://localhost:8000/queries.json
 print_r($response);
 
 ?>
-
1
+
1
 2
 3
 4
@@ -360,7 +360,7 @@ http://localhost:8000/queries.json
 )
 
 puts response
-
1
+
1
 2
 3
 4
@@ -435,4 +435,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');
\ No newline at end of file
+_st('install','HaUfpXXV87xoB_zzCQ45');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/complementarypurchase/quickstart/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/complementarypurchase/quickstart/index.html.gz b/templates/complementarypurchase/quickstart/index.html.gz
index ff24ecb..ffb02fd 100644
Binary files a/templates/complementarypurchase/quickstart/index.html.gz and b/templates/complementarypurchase/quickstart/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/adjust-score/index.html
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/adjust-score/index.html b/templates/ecommercerecommendation/adjust-score/index.html
index b79f08f..2987b92 100644
--- a/templates/ecommercerecommendation/adjust-score/index.html
+++ b/templates/ecommercerecommendation/adjust-score/index.html
@@ -248,4 +248,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');
\ No newline at end of file
+_st('install','HaUfpXXV87xoB_zzCQ45');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/adjust-score/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/adjust-score/index.html.gz b/templates/ecommercerecommendation/adjust-score/index.html.gz
index 1188760..f76fecb 100644
Binary files a/templates/ecommercerecommendation/adjust-score/index.html.gz and b/templates/ecommercerecommendation/adjust-score/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/dase/index.html
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/dase/index.html b/templates/ecommercerecommendation/dase/index.html
index 443956c..cfe3ada 100644
--- a/templates/ecommercerecommendation/dase/index.html
+++ b/templates/ecommercerecommendation/dase/index.html
@@ -803,4 +803,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');
\ No newline at end of file
+_st('install','HaUfpXXV87xoB_zzCQ45');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/dase/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/dase/index.html.gz b/templates/ecommercerecommendation/dase/index.html.gz
index 1d99417..930a35b 100644
Binary files a/templates/ecommercerecommendation/dase/index.html.gz and b/templates/ecommercerecommendation/dase/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/how-to/index.html
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/how-to/index.html b/templates/ecommercerecommendation/how-to/index.html
index d1df6f9..7504755 100644
--- a/templates/ecommercerecommendation/how-to/index.html
+++ b/templates/ecommercerecommendation/how-to/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');
\ No newline at end of file
+_st('install','HaUfpXXV87xoB_zzCQ45');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/how-to/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/how-to/index.html.gz b/templates/ecommercerecommendation/how-to/index.html.gz
index 3dba55e..f871206 100644
Binary files a/templates/ecommercerecommendation/how-to/index.html.gz and b/templates/ecommercerecommendation/how-to/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/quickstart/index.html
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/quickstart/index.html b/templates/ecommercerecommendation/quickstart/index.html
index 7d93ede..2744905 100644
--- a/templates/ecommercerecommendation/quickstart/index.html
+++ b/templates/ecommercerecommendation/quickstart/index.html
@@ -32,7 +32,7 @@ Your system is all ready to go.
 [INFO] [App$]               MyApp1 |    1 | 3mZWDzci2D5YsqAnqNnXH9SB6Rg3dsTBs8iHkK6X2i54IQsIZI1eEeQQyMfs7b3F | (all)
 [INFO] [App$]               MyApp2 |    2 | io5lz6Eg4m3Xe4JZTBFE13GMAf1dhFl6ZteuJfrO84XpdOz9wRCrDU44EUaYuXq5 | (all)
 [INFO] [App$] Finished listing 2 app(s).
-

4. Collecting Data

Next, let's collect training data for this Engine. By default, the E-Commerce Recommendation Engine Template supports 2 types of entities and 2 events: user and item; events view and buy. An item has the categories property, which is a list of category names (String). A user can view and buy an item. The specical constraint entiy with entityId unavailableItems defines a list of unavailable items and is taken into account in realtime during serving.

In summary, this template requires '$set' user event, '$set' item event, user-view-item events, user-buy-item event and '$set' constraint event.

This template can easily be customized to consider other user-to-it em events.

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 App Integration Overview for more details how to integrate your app with SDK.

Let's try sending events to EventServer with the following curl commands (The corresponding SDK code is showed in other tabs).

Replace <ACCCESS_KEY> by the Access Key generated in above steps. Note that localhost:7070 is the default URL of the Event Server.

For convenience, set your access key to the shell variable, run:

$ ACCESS_KEY=<ACCESS_KEY>

For example, when a new user with id "u0" is created in your app on time 2014-11-02T09:39:45.618-08:00 (current time will be used if eventTime is not specified), you can send a $set event for this user. To send this event, run the following curl command:

1
+

4. Collecting Data

Next, let's collect training data for this Engine. By default, the E-Commerce Recommendation Engine Template supports 2 types of entities and 2 events: user and item; events view and buy. An item has the categories property, which is a list of category names (String). A user can view and buy an item. The specical constraint entiy with entityId unavailableItems defines a list of unavailable items and is taken into account in realtime during serving.

In summary, this template requires '$set' user event, '$set' item event, user-view-item events, user-buy-item event and '$set' constraint event.

This template can easily be customized to consider other user-to-it em events.

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 App Integration Overview for more details how to integrate your app with SDK.

Let's try sending events to EventServer with the following curl commands (The corresponding SDK code is showed in other tabs).

Replace <ACCCESS_KEY> by the Access Key generated in above steps. Note that localhost:7070 is the default URL of the Event Server.

For convenience, set your access key to the shell variable, run:

$ ACCESS_KEY=<ACCESS_KEY>

For example, when a new user with id "u0" is created in your app on time 2014-11-02T09:39:45.618-08:00 (current time will be used if eventTime is not specified), you can send a $set event for this user. To send this event, run the following curl command:

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"
 }'
-
1
+
1
 2
 3
 4
@@ -78,7 +78,7 @@ Your system is all ready to go.
   entity_type="user",
   entity_id=<USER_ID>
 )
-
1
+
1
 2
 3
 4
@@ -119,7 +119,7 @@ Your system is all ready to go.
   'properties' => array('categories' => array('<CATEGORY_1>', '<CATEGORY_2>'))
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -136,7 +136,7 @@ Your system is all ready to go.
   'user',
   <USER ID>
 )
-
1
+
1
 2
 3
 4
@@ -161,7 +161,7 @@ Your system is all ready to go.
   .entityType("user")
   .entityId(<USER_ID>);
 client.createEvent(userEvent);
-

When a new item "i0" is created in your app on time 2014-11-02T09:39:45.618-08:00 (current time will be used if eventTime is not specified), you can send a $set event for the item. Note that the item is set with categories properties: "c1" and "c2". Run the following curl command:

When a new item "i0" is created in your app on time 2014-11-02T09:39:45.618-08:00 (current time will be used if eventTime is not specified), you can send a $set event for the item. Note that the item is set with categories properties: "c1" and "c2". Run the following curl command:

1
 2
 3
 4
@@ -182,7 +182,7 @@ Your system is all ready to go.
   }
   "eventTime" : "2014-11-02T09:39:45.618-08:00"
 }'
-
1
+
1
 2
 3
 4
@@ -201,7 +201,7 @@ Your system is all ready to go.
     "categories" : ["<CATEGORY_1>", "<CATEGORY_2>"]
   }
 )
-
1
+
1
 2
 3
 4
@@ -218,7 +218,7 @@ Your system is all ready to go.
   'properties' => array('categories' => array('<CATEGORY_1>', '<CATEGORY_2>'))
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -235,7 +235,7 @@ Your system is all ready to go.
   }
 )
 
-
1
+
1
 2
 3
 4
@@ -248,7 +248,7 @@ Your system is all ready to go.
   .entityId(<ITEM_ID>)
   .property("categories", ImmutableList.of("<CATEGORY_1>", "<CATEGORY_2>"));
 client.createEvent(itemEvent)
-

The properties of the user and item can be set, unset, or delete by special events $set, $unset and $delete. Please refer to Event API for more details of using these events.

When the user "u0" view item "i0" on time 2014-11-10T12:34:56.123-08:00 (current time will be used if eventTime is not specified), you can send a view event. Run the following curl command:

The properties of the user and item can be set, unset, or delete by special events $set, $unset and $delete. Please refer to Event API for more details of using these events.

When the user "u0" view item "i0" on time 2014-11-10T12:34:56.123-08:00 (current time will be used if eventTime is not specified), you can send a view event. Run the following curl command:

1
 2
 3
 4
@@ -267,7 +267,7 @@ Your system is all ready to go.
   "targetEntityId" : "i0",
   "eventTime" : "2014-11-10T12:34:56.123-08:00"
 }'
-
1
+
1
 2
 3
 4
@@ -284,7 +284,7 @@ Your system is all ready to go.
   target_entity_type="item",
   target_entity_id=<ITEM ID>
 )
-
1
+
1
 2
 3
 4
@@ -303,7 +303,7 @@ Your system is all ready to go.
    'targetEntityId' => <ITEM ID>
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -322,7 +322,7 @@ Your system is all ready to go.
   }
 )
 
-
1
+
1
 2
 3
 4
@@ -337,7 +337,7 @@ Your system is all ready to go.
     .targetEntityType("item")
     .targetEntityId(<ITEM_ID>);
 client.createEvent(viewEvent);
-

When the user "u0" buy item "i0" on time 2014-11-10T13:00:00.123-08:00 (current time will be used if eventTime is not specified), you can send a view event. Run the following curl command:

When the user "u0" buy item "i0" on time 2014-11-10T13:00:00.123-08:00 (current time will be used if eventTime is not specified), you can send a view event. Run the following curl command:

1
 2
 3
 4
@@ -356,7 +356,7 @@ Your system is all ready to go.
   "targetEntityId" : "i0",
   "eventTime" : "2014-11-10T13:00:00.123-08:00"
 }'
-
1
+
1
 2
 3
 4
@@ -373,7 +373,7 @@ Your system is all ready to go.
   target_entity_type="item",
   target_entity_id=<ITEM ID>
 )
-
1
+
1
 2
 3
 4
@@ -392,7 +392,7 @@ Your system is all ready to go.
    'targetEntityId' => <ITEM ID>
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -409,7 +409,7 @@ Your system is all ready to go.
     'targetEntityId' => <ITEM ID>
   }
 )
-
1
+
1
 2
 3
 4
@@ -490,19 +490,19 @@ User u10 buys item i40
 

When the engine is deployed successfully and running, you should see a console message similar to the following:

1
 2
[INFO] [HttpListener] Bound to /0.0.0.0:8000
 [INFO] [MasterActor] Bind successful. Ready to serve.
-

Do not kill the deployed engine process.

By default, the deployed engine binds to http://localhost:8000. You can visit that page in your web browser to check its status.

Engine Status

6. Use the Engine

Now, You can retrieve predicted results. To recommend 4 items to user ID "u1". You send this JSON { "user": ["u1"], "num": 4 } 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 EngineClient of an SDK.

With the deployed engine running, open another terminal and run the following curl command or use SDK to send the query:

1
+

Do not kill the deployed engine process.

By default, the deployed engine binds to http://localhost:8000. You can visit that page in your web browser to check its status.

Engine Status

6. Use the Engine

Now, You can retrieve predicted results. To recommend 4 items to user ID "u1". You send this JSON { "user": "u1", "num": 4 } 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 EngineClient of an SDK.

With the deployed engine running, open another terminal and run the following curl command or use SDK to send the query:

1
 2
 3
 4
$ curl -H "Content-Type: application/json" \
 -d '{ "user": "u1", "num": 4 }' \
 http://localhost:8000/queries.json
 
-
1
+
1
 2
 3
import predictionio
 engine_client = predictionio.EngineClient(url="http://localhost:8000")
 print engine_client.send_query({"user": "u1", "num": 4})
-
1
+
1
 2
 3
 4
@@ -521,7 +521,7 @@ http://localhost:8000/queries.json
 print_r($response);
 
 ?>
-
1
+
1
 2
 3
 4
@@ -534,7 +534,7 @@ http://localhost:8000/queries.json
 response = client.send_query('user' => 'i1', 'num' => 4)
 
 puts response
-
1
+
1
 2
 3
 4
@@ -578,7 +578,7 @@ http://localhost:8000/queries.json
     {"item":"i3","score":0.003007015026561692}
   ]
 }
-

MyECommerceRecommendation is now running.

To update the model periodically with new data, simply set up a cron job to call pio train and pio deploy. The engine will continue to serve prediction results during the re-train process. After the training is completed, pio deploy will automatically shutdown the existing engine server and bring up a new process on the same port.

Note that if you import a large data set and the training seems to be taking forever or getting stuck, it's likely that there is not enough executor memory. It's recommended to setup a Spark standalone cluster, you'll need to specify more driver and executor memory when training with a large data set. Please see FAQ here for instructions.

Setting constraint "unavailableItems"

Now let's send a item contraint "unavailableItems" (replace accessKey with your Access Key):

You can also use SDK to send this event as decribed in the SDK sample above.

1
+

MyECommerceRecommendation is now running.

To update the model periodically with new data, simply set up a cron job to call pio train and pio deploy. The engine will continue to serve prediction results during the re-train process. After the training is completed, pio deploy will automatically shutdown the existing engine server and bring up a new process on the same port.

Note that if you import a large data set and the training seems to be taking forever or getting stuck, it's likely that there is not enough executor memory. It's recommended to setup a Spark standalone cluster, you'll need to specify more driver and executor memory when training with a large data set. Please see FAQ here for instructions.

Setting constraint "unavailableItems"

Now let's send a item contraint "unavailableItems" (replace accessKey with your Access Key):

You can also use SDK to send this event as decribed in the SDK sample above.

1
 2
 3
 4
@@ -599,7 +599,7 @@ http://localhost:8000/queries.json
   }
   "eventTime" : "2015-02-17T02:11:21.934Z"
 }'
-
1
+
1
 2
 3
 4
@@ -618,7 +618,7 @@ http://localhost:8000/queries.json
     "items" : ["<ITEM ID1>", "<ITEM ID2>"]
   }
 )
-
1
+
1
 2
 3
 4
@@ -635,7 +635,7 @@ http://localhost:8000/queries.json
   'properties' => array('items' => array('<ITEM ID1>', '<ITEM ID2>'))
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -650,7 +650,7 @@ http://localhost:8000/queries.json
     'properties' => { 'items' => ['<ITEM ID1>', '<ITEM ID2>'] }
   }
 )
-
1
+
1
 2
 3
 4
@@ -759,4 +759,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');
\ No newline at end of file
+_st('install','HaUfpXXV87xoB_zzCQ45');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/quickstart/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/quickstart/index.html.gz b/templates/ecommercerecommendation/quickstart/index.html.gz
index b5d20b1..bce7552 100644
Binary files a/templates/ecommercerecommendation/quickstart/index.html.gz and b/templates/ecommercerecommendation/quickstart/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/train-with-rate-event/index.html
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/train-with-rate-event/index.html b/templates/ecommercerecommendation/train-with-rate-event/index.html
index f67ad11..3cb10e7 100644
--- a/templates/ecommercerecommendation/train-with-rate-event/index.html
+++ b/templates/ecommercerecommendation/train-with-rate-event/index.html
@@ -272,4 +272,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');
\ No newline at end of file
+_st('install','HaUfpXXV87xoB_zzCQ45');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/ecommercerecommendation/train-with-rate-event/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/ecommercerecommendation/train-with-rate-event/index.html.gz b/templates/ecommercerecommendation/train-with-rate-event/index.html.gz
index b578a7d..f64237d 100644
Binary files a/templates/ecommercerecommendation/train-with-rate-event/index.html.gz and b/templates/ecommercerecommendation/train-with-rate-event/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/index.html
----------------------------------------------------------------------
diff --git a/templates/index.html b/templates/index.html
index dadf8ad..55ff1e4 100644
--- a/templates/index.html
+++ b/templates/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');
\ No newline at end of file
+_st('install','HaUfpXXV87xoB_zzCQ45');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/index.html.gz b/templates/index.html.gz
index fc01343..50cec89 100644
Binary files a/templates/index.html.gz and b/templates/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/javaecommercerecommendation/dase/index.html
----------------------------------------------------------------------
diff --git a/templates/javaecommercerecommendation/dase/index.html b/templates/javaecommercerecommendation/dase/index.html
index 58a47f0..a1e327f 100644
--- a/templates/javaecommercerecommendation/dase/index.html
+++ b/templates/javaecommercerecommendation/dase/index.html
@@ -470,4 +470,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');
\ No newline at end of file
+_st('install','HaUfpXXV87xoB_zzCQ45');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/9e2aa2d4/templates/javaecommercerecommendation/dase/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/javaecommercerecommendation/dase/index.html.gz b/templates/javaecommercerecommendation/dase/index.html.gz
index 79d6bc2..4d132e4 100644
Binary files a/templates/javaecommercerecommendation/dase/index.html.gz and b/templates/javaecommercerecommendation/dase/index.html.gz differ