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 7BAA8200D33 for ; Wed, 8 Nov 2017 20:18:32 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7A2191609E0; Wed, 8 Nov 2017 19:18:32 +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 A073D160BDA for ; Wed, 8 Nov 2017 20:18:30 +0100 (CET) Received: (qmail 48030 invoked by uid 500); 8 Nov 2017 19:18:29 -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 48021 invoked by uid 99); 8 Nov 2017 19:18:29 -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; Wed, 08 Nov 2017 19:18:29 +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 AEBC01A34C2 for ; Wed, 8 Nov 2017 19:18:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.722 X-Spam-Level: X-Spam-Status: No, score=-3.722 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_NUMSUBJECT=0.5, 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 jfoQA6uCyCb0 for ; Wed, 8 Nov 2017 19:18:19 +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 BA08C5FAF9 for ; Wed, 8 Nov 2017 19:18:17 +0000 (UTC) Received: (qmail 46507 invoked by uid 99); 8 Nov 2017 19:18:16 -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; Wed, 08 Nov 2017 19:18:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1DDBBF5BEA; Wed, 8 Nov 2017 19:18:15 +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: Wed, 08 Nov 2017 19:18:15 -0000 Message-Id: <293f2cab518c4499a0568617c7b093bb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/12] incubator-predictionio-site git commit: Documentation based on apache/incubator-predictionio#e1b211e8d90b21baa41a3b0f31bee8f953097315 archived-at: Wed, 08 Nov 2017 19:18:32 -0000 Repository: incubator-predictionio-site Updated Branches: refs/heads/asf-site eaa3a41f5 -> 1da18bd7e http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/1da18bd7/templates/similarproduct/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/similarproduct/quickstart/index.html b/templates/similarproduct/quickstart/index.html index 62bcaa4..8a786bc 100644 --- a/templates/similarproduct/quickstart/index.html +++ b/templates/similarproduct/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 some training data for the app of this Engine. By default, the Similar Product Engine Template supports 2 types of entities: user and item, and event view. An item has the categories 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.

This template can easily be customized to consider more user events such as buy, rate and like.

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 detai ls 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 some training data for the app of this Engine. By default, the Similar Product Engine Template supports 2 types of entities: user and item, and event view. An item has the categories 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.

This template can easily be customized to consider more user events such as buy, rate and like.

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 detai ls 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
@@ -86,7 +86,7 @@ Your system is all ready to go.
   event_time=datetime(
     2014, 11, 02, 09, 39, 45, 618000, pytz.timezone('US/Pacific')
 )
-
1
+
1
 2
 3
 4
@@ -111,7 +111,7 @@ Your system is all ready to go.
   'entityId' => <USER ID>
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -128,7 +128,7 @@ Your system is all ready to go.
   'user',
   <USER ID>
 )
-
1
+
1
 2
 3
 4
@@ -153,7 +153,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
@@ -174,7 +174,7 @@ Your system is all ready to go.
   }
   "eventTime" : "2014-11-02T09:39:45.618-08:00"
 }'
-
1
+
1
 2
 3
 4
@@ -193,7 +193,7 @@ Your system is all ready to go.
     "categories" : ["<CATEGORY_1>", "<CATEGORY_2>"]
   }
 )
-
1
+
1
 2
 3
 4
@@ -214,7 +214,7 @@ Your system is all ready to go.
 ));
 
 ?>
-
1
+
1
 2
 3
 4
@@ -231,7 +231,7 @@ Your system is all ready to go.
   }
 )
 
-
1
+
1
 2
 3
 4
@@ -244,7 +244,7 @@ Your system is all ready to go.
   .entityId(<ITEM_ID>)
   .property("categories", ImmutableList.of("<CATEGORY_1>", "<CATEGORY_2>"));
 client.createEvent(itemEvent)
-

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:

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
@@ -263,7 +263,7 @@ Your system is all ready to go.
   "targetEntityId" : "i0",
   "eventTime" : "2014-11-10T12:34:56.123-08:00"
 }'
-
1
+
1
 2
 3
 4
@@ -280,7 +280,7 @@ Your system is all ready to go.
   target_entity_type="item",
   target_entity_id=<ITEM ID>
 )
-
1
+
1
 2
 3
 4
@@ -299,7 +299,7 @@ Your system is all ready to go.
    'targetEntityId' => <ITEM ID>
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -316,7 +316,7 @@ Your system is all ready to go.
     'targetEntityId' => <ITEM ID>
   }
 )
-
1
+
1
 2
 3
 4
@@ -376,19 +376,19 @@ User u10 views item i29
 

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 retrieve 4 items which are similar to item ID "i1". You send this JSON { "items": ["i1"], "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 retrieve 4 items which are similar to item ID "i1". You send this JSON { "items": ["i1"], "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 '{ "items": ["i1"], "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({"items": ["i1"], "num": 4})
-
1
+
1
 2
 3
 4
@@ -407,7 +407,7 @@ http://localhost:8000/queries.json
 print_r($response);
 
 ?>
-
1
+
1
 2
 3
 4
@@ -420,7 +420,7 @@ http://localhost:8000/queries.json
 response = client.send_query('items' => ['i1'], 'num' => 4)
 
 puts response
-
1
+
1
 2
 3
 4
@@ -533,4 +533,4 @@ http://localhost:8000/queries.json
 e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
 })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
 
-_st('install','HaUfpXXV87xoB_zzCQ45');
\ 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/1da18bd7/templates/similarproduct/quickstart/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/similarproduct/quickstart/index.html.gz b/templates/similarproduct/quickstart/index.html.gz
index 46e25fe..aeb8fee 100644
Binary files a/templates/similarproduct/quickstart/index.html.gz and b/templates/similarproduct/quickstart/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/1da18bd7/templates/similarproduct/recommended-user/index.html
----------------------------------------------------------------------
diff --git a/templates/similarproduct/recommended-user/index.html b/templates/similarproduct/recommended-user/index.html
index 09a1c59..f0a4588 100644
--- a/templates/similarproduct/recommended-user/index.html
+++ b/templates/similarproduct/recommended-user/index.html
@@ -182,4 +182,4 @@ http://localhost:8000/queries.json
 e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
 })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
 
-_st('install','HaUfpXXV87xoB_zzCQ45');
\ 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/1da18bd7/templates/similarproduct/recommended-user/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/similarproduct/recommended-user/index.html.gz b/templates/similarproduct/recommended-user/index.html.gz
index 846ddd3..3e4d00b 100644
Binary files a/templates/similarproduct/recommended-user/index.html.gz and b/templates/similarproduct/recommended-user/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/1da18bd7/templates/similarproduct/return-item-properties/index.html
----------------------------------------------------------------------
diff --git a/templates/similarproduct/return-item-properties/index.html b/templates/similarproduct/return-item-properties/index.html
index 5d9020c..fe2133c 100644
--- a/templates/similarproduct/return-item-properties/index.html
+++ b/templates/similarproduct/return-item-properties/index.html
@@ -150,4 +150,4 @@ http://localhost:8000/queries.json
 e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
 })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
 
-_st('install','HaUfpXXV87xoB_zzCQ45');
\ 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/1da18bd7/templates/similarproduct/return-item-properties/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/similarproduct/return-item-properties/index.html.gz b/templates/similarproduct/return-item-properties/index.html.gz
index 218df90..7470665 100644
Binary files a/templates/similarproduct/return-item-properties/index.html.gz and b/templates/similarproduct/return-item-properties/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/1da18bd7/templates/similarproduct/rid-user-set-event/index.html
----------------------------------------------------------------------
diff --git a/templates/similarproduct/rid-user-set-event/index.html b/templates/similarproduct/rid-user-set-event/index.html
index f4f15c8..555ffaf 100644
--- a/templates/similarproduct/rid-user-set-event/index.html
+++ b/templates/similarproduct/rid-user-set-event/index.html
@@ -132,4 +132,4 @@
 e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
 })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
 
-_st('install','HaUfpXXV87xoB_zzCQ45');
\ 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/1da18bd7/templates/similarproduct/rid-user-set-event/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/similarproduct/rid-user-set-event/index.html.gz b/templates/similarproduct/rid-user-set-event/index.html.gz
index b6970d0..dd2a4d5 100644
Binary files a/templates/similarproduct/rid-user-set-event/index.html.gz and b/templates/similarproduct/rid-user-set-event/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/1da18bd7/templates/similarproduct/train-with-rate-event/index.html
----------------------------------------------------------------------
diff --git a/templates/similarproduct/train-with-rate-event/index.html b/templates/similarproduct/train-with-rate-event/index.html
index 142536e..8074bd9 100644
--- a/templates/similarproduct/train-with-rate-event/index.html
+++ b/templates/similarproduct/train-with-rate-event/index.html
@@ -252,4 +252,4 @@
 e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
 })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
 
-_st('install','HaUfpXXV87xoB_zzCQ45');
\ 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/1da18bd7/templates/similarproduct/train-with-rate-event/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/similarproduct/train-with-rate-event/index.html.gz b/templates/similarproduct/train-with-rate-event/index.html.gz
index 4465b3f..f8bb053 100644
Binary files a/templates/similarproduct/train-with-rate-event/index.html.gz and b/templates/similarproduct/train-with-rate-event/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/1da18bd7/templates/vanilla/dase/index.html
----------------------------------------------------------------------
diff --git a/templates/vanilla/dase/index.html b/templates/vanilla/dase/index.html
index a4308d0..c07388c 100644
--- a/templates/vanilla/dase/index.html
+++ b/templates/vanilla/dase/index.html
@@ -172,4 +172,4 @@
 e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
 })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
 
-_st('install','HaUfpXXV87xoB_zzCQ45');
\ 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/1da18bd7/templates/vanilla/dase/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/vanilla/dase/index.html.gz b/templates/vanilla/dase/index.html.gz
index 5cc8cb2..fa5258f 100644
Binary files a/templates/vanilla/dase/index.html.gz and b/templates/vanilla/dase/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/1da18bd7/templates/vanilla/quickstart/index.html
----------------------------------------------------------------------
diff --git a/templates/vanilla/quickstart/index.html b/templates/vanilla/quickstart/index.html
index 83fe967..7383ee6 100644
--- a/templates/vanilla/quickstart/index.html
+++ b/templates/vanilla/quickstart/index.html
@@ -54,17 +54,17 @@ Your system is all ready to go.
 

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 try to retrieve predicted results. The engine accepts JSON query with the field 'q': { "q" : "foo" }. A prefix is added to the query data and return as PredictedResult.

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 try to retrieve predicted results. The engine accepts JSON query with the field 'q': { "q" : "foo" }. A prefix is added to the query data and return as PredictedResult.

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

1
 2
 3
$ curl -H "Content-Type: application/json" \
 -d '{ "q": "foo" }' http://localhost:8000/queries.json
 
-
1
+
1
 2
 3
import predictionio
 engine_client = predictionio.EngineClient(url="http://localhost:8000")
 print engine_client.send_query({ "q": "foo" })
-
1
+
1
 2
 3
 4
@@ -83,7 +83,7 @@ Your system is all ready to go.
 print_r($response);
 
 ?>
-
1
+
1
 2
 3
 4
@@ -96,7 +96,7 @@ Your system is all ready to go.
 response = client.send_query('q' => 'foo')
 
 puts response
-
1
+
1
 2
 3
 4
@@ -125,4 +125,4 @@ Your system is all ready to go.
 e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
 })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
 
-_st('install','HaUfpXXV87xoB_zzCQ45');
\ 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/1da18bd7/templates/vanilla/quickstart/index.html.gz
----------------------------------------------------------------------
diff --git a/templates/vanilla/quickstart/index.html.gz b/templates/vanilla/quickstart/index.html.gz
index 43f327e..bae87a2 100644
Binary files a/templates/vanilla/quickstart/index.html.gz and b/templates/vanilla/quickstart/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/1da18bd7/tryit/index.html
----------------------------------------------------------------------
diff --git a/tryit/index.html b/tryit/index.html
index 04560ab..b0863d1 100644
--- a/tryit/index.html
+++ b/tryit/index.html
@@ -3,4 +3,4 @@
 e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
 })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
 
-_st('install','HaUfpXXV87xoB_zzCQ45');
\ 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/1da18bd7/tryit/index.html.gz
----------------------------------------------------------------------
diff --git a/tryit/index.html.gz b/tryit/index.html.gz
index dd6b148..7e5c4b0 100644
Binary files a/tryit/index.html.gz and b/tryit/index.html.gz differ