From commits-return-5503-archive-asf-public=cust-asf.ponee.io@predictionio.apache.org Fri Oct 5 13:22:41 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4F8F118077A for ; Fri, 5 Oct 2018 13:22:39 +0200 (CEST) Received: (qmail 79173 invoked by uid 500); 5 Oct 2018 11:22:38 -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 79142 invoked by uid 99); 5 Oct 2018 11:22:38 -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; Fri, 05 Oct 2018 11:22:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D6148E012E; Fri, 5 Oct 2018 11:22:37 +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.apache.org Date: Fri, 05 Oct 2018 11:22:38 -0000 Message-Id: <5ab2a92f4952462f96ce19f6da1c4984@git.apache.org> In-Reply-To: <4e84074e13cf49d199bc6f07f224a47c@git.apache.org> References: <4e84074e13cf49d199bc6f07f224a47c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/7] predictionio-site git commit: Documentation based on apache/predictionio#144d23c344c800ee0691a685d97a21df4fb7c3da http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/fef1e81c/templates/productranking/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/productranking/quickstart/index.html b/templates/productranking/quickstart/index.html index ab71b6a..276115e 100644 --- a/templates/productranking/quickstart/index.html +++ b/templates/productranking/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 Product Ranking Engine Template supports 2 types of entities: user and item, and event view. A user can view an item. This template requires '$set' user event, '$set' item event and user-view-item 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 some training data for the app of this Engine. By default, the Product Ranking Engine Template supports 2 types of entities: user and item, and event view. A user can view an item. This template requires '$set' user event, '$set' item event and user-view-item 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
@@ -103,7 +103,7 @@ Your system is all ready to go.
   'entityId' => <USER ID>
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -120,7 +120,7 @@ Your system is all ready to go.
   'user',
   <USER ID>
 )
-
1
+
1
 2
 3
 4
@@ -145,7 +145,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. 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. Run the following curl command:

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"
 }'
-
1
+
1
 2
 3
 4
@@ -173,7 +173,7 @@ Your system is all ready to go.
   entity_type="item",
   entity_id=<ITEM_ID>
 )
-
1
+
1
 2
 3
 4
@@ -190,7 +190,7 @@ Your system is all ready to go.
 ));
 
 ?>
-
1
+
1
 2
 3
 4
@@ -203,7 +203,7 @@ Your system is all ready to go.
   <ITEM ID>
 )
 
-
1
+
1
 2
 3
 4
@@ -214,7 +214,7 @@ Your system is all ready to go.
   .entityType("item")
   .entityId(<ITEM_ID>);
 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
@@ -233,7 +233,7 @@ Your system is all ready to go.
   "targetEntityId" : "i0",
   "eventTime" : "2014-11-10T12:34:56.123-08:00"
 }'
-
1
+
1
 2
 3
 4
@@ -250,7 +250,7 @@ Your system is all ready to go.
   target_entity_type="item",
   target_entity_id=<ITEM ID>
 )
-
1
+
1
 2
 3
 4
@@ -269,7 +269,7 @@ Your system is all ready to go.
    'targetEntityId' => <ITEM ID>
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -286,7 +286,7 @@ Your system is all ready to go.
     'targetEntityId' => <ITEM ID>
   }
 )
-
1
+
1
 2
 3
 4
@@ -344,14 +344,14 @@ User u10 views item i7
 

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 rank items with IDs "i1", "i3", "i10", "i2", "i5", "i31", "i9" for user "u2". You send this JSON { "user": "u2", "items": ["i1", "i3", "i10", "i2", "i5", "i31", "i9"] } 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 EngineCl ient 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 rank items with IDs "i1", "i3", "i10", "i2", "i5", "i31", "i9" for user "u2". You send this JSON { "user": "u2", "items": ["i1", "i3", "i10", "i2", "i5", "i31", "i9"] } 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 EngineCl ient 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": "u2", "items": ["i1", "i3", "i10", "i2", "i5", "i31", "i9"]}' \
 http://localhost:8000/queries.json
 
-
1
+
1
 2
 3
 4
@@ -362,7 +362,7 @@ http://localhost:8000/queries.json
   "user": "u2",
   "items": ["i1", "i3", "i10", "i2", "i5", "i31", "i9"]
 })
-
1
+
1
 2
 3
 4
@@ -385,7 +385,7 @@ http://localhost:8000/queries.json
 print_r($response);
 
 ?>
-
1
+
1
 2
 3
 4
@@ -402,7 +402,7 @@ http://localhost:8000/queries.json
   'items' => ['i1', 'i3', 'i10', 'i2', 'i5', 'i31', 'i9'])
 
 puts response
-
1
+
1
 2
 3
 4

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/fef1e81c/templates/recommendation/quickstart/index.html
----------------------------------------------------------------------
diff --git a/templates/recommendation/quickstart/index.html b/templates/recommendation/quickstart/index.html
index ae9e777..22337ba 100644
--- a/templates/recommendation/quickstart/index.html
+++ b/templates/recommendation/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. By default, the Recommendation Engine Template supports 2 types of events: rate and buy. A user can give a rating score to an item or buy an item. This template requires user-view-item and user-buy-item events.

This template can easily be customized to consider more user events such as like, dislike etc.

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).

< p>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>

Example rate event

A user (ID "u0") gives an item (ID "i0") a rating of 5 at 2014-11-02T09:39:45.618-08:00 (current time will be used if eventTime is not specified)

Run the following curl command to send the rate event:

1
+

4. Collecting Data

Next, let's collect some training data. By default, the Recommendation Engine Template supports 2 types of events: rate and buy. A user can give a rating score to an item or buy an item. This template requires user-view-item and user-buy-item events.

This template can easily be customized to consider more user events such as like, dislike etc.

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).

< p>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>

Example rate event

A user (ID "u0") gives an item (ID "i0") a rating of 5 at 2014-11-02T09:39:45.618-08:00 (current time will be used if eventTime is not specified)

Run the following curl command to send the rate event:

1
 2
 3
 4
@@ -57,7 +57,7 @@ Your system is all ready to go.
   }
   "eventTime" : "2014-11-02T09:39:45.618-08:00"
 }'
-
1
+
1
 2
 3
 4
@@ -92,7 +92,7 @@ Your system is all ready to go.
     target_entity_id=<ITEM ID>,
     properties= { "rating" : float(<RATING>) }
 )
-
1
+
1
 2
 3
 4
@@ -123,7 +123,7 @@ Your system is all ready to go.
    'properties' => array('rating'=> <RATING>)
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -150,7 +150,7 @@ Your system is all ready to go.
   }
 )
 
-
1
+
1
 2
 3
 4
@@ -179,7 +179,7 @@ Your system is all ready to go.
     .property("rating", new Float(<RATING>));
 client.createEvent(rateEvent);
 
-

Example buy event

A user (ID "u1") buys an item (ID "i2") at 2014-11-10T12:34:56.123-08:00 (current time will be used if eventTime is not specified)

Run the following curl command to send the buy event:

Example buy event

A user (ID "u1") buys an item (ID "i2") at 2014-11-10T12:34:56.123-08:00 (current time will be used if eventTime is not specified)

Run the following curl command to send the buy event:

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"
 }'
-
1
+
1
 2
 3
 4
@@ -213,7 +213,7 @@ Your system is all ready to go.
     target_entity_type="item",
     target_entity_id=<ITEM ID>
 )
-
1
+
1
 2
 3
 4
@@ -232,7 +232,7 @@ Your system is all ready to go.
    'targetEntityId' => <ITEM ID>
 ));
 ?>
-
1
+
1
 2
 3
 4
@@ -249,7 +249,7 @@ Your system is all ready to go.
     'targetEntityId' => <ITEM ID>
   }
 )
-
1
+
1
 2
 3
 4
@@ -297,17 +297,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. To recommend 4 movies to user whose id is 1, you send this JSON { "user": "1", "num": 4 } 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 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 try to retrieve predicted results. To recommend 4 movies to user whose id is 1, you send this JSON { "user": "1", "num": 4 } 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 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
$ curl -H "Content-Type: application/json" \
 -d '{ "user": "1", "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": "1", "num": 4})
-
1
+
1
 2
 3
 4
@@ -326,7 +326,7 @@ Your system is all ready to go.
 print_r($response);
 
 ?>
-
1
+
1
 2
 3
 4
@@ -339,7 +339,7 @@ Your system is all ready to go.
 response = client.send_query('user' => <USER ID>, 'num' => <NUMBER (integer)>)
 
 puts response
-
1
+
1
 2
 3
 4

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/fef1e81c/templates/similarproduct/quickstart/index.html
----------------------------------------------------------------------
diff --git a/templates/similarproduct/quickstart/index.html b/templates/similarproduct/quickstart/index.html
index 5fda042..56c31ea 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