anchor.diff:  - item's categories
   
   
  +## Create a new Engine from an Engine Template
  +
  +Now let's create a new engine called *MySimilar* by cloning the Similar Product Discovery Engine Template, assuming `/home/yourname/predictionio`
  +is the installation directory of PredictionIO:
  +
  +```
  +$ cp -r /home/yourname/predictionio/templates/scala-parallel-similar MySimilar
  +$ cd MySimilar
  +```
  +
  +## Collecting Data
  +
  +
  +Next, let's collect some training data for the app of this Engine. By default,
  +the Similar 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.
  +
  +You can send these data to PredictionIO Event Server in real-time easily by
  +making a HTTP request or through the `EventClient` of an SDK.
  +
  +
  +
  +<div class="tabs">
  +  <div data-tab="Python SDK" data-lang="python">
  +```python
  +import predictionio
  +
  +client = predictionio.EventClient(
  +  access_key=<ACCESS KEY>,
  +  url=<URL OF EVENTSERVER>,
  +  threads=5,
  +  qsize=500
  +)
  +
  +# Create a new user
  +
  +client.create_event(
  +  event="$set",
  +  entity_type="user",
  +  entity_id=<USER_ID>
  +)
  +
  +# Create a new item or set existing item's categories
  +
  +client.create_event(
  +  event="$set",
  +  entity_type="item",
  +  entity_id=item_id,
  +  properties={
  +    "categories" : ["<CATEGORY_1>", "<CATEGORY_2>"]
  +  }
  +)
  +
  +# A user views an item
  +
  +client.create_event(
  +    event="view",
  +    entity_type="user",
  +    entity_id=<USER ID>,
  +    target_entity_type="item",
  +    target_entity_id=<ITEM ID>
  +)
  +```
  +  </div>
  +  <div data-tab="PHP SDK" data-lang="php">
  +(TODO: UPDATE ME)
  +```php
  +<?php
  +require_once("vendor/autoload.php");
  +use predictionio\EventClient;
  +
  +$client = new EventClient(<ACCESS KEY>, <URL OF EVENTSERVER>);
  +
  +// A user rates an item
  +$client->createEvent(array(
  +   'event' => 'rate',
  +   'entityType' => 'user',
  +   'entityId' => <USER ID>,
  +   'targetEntityType' => 'item',
  +   'targetEntityId' => <ITEM ID>,
  +   'properties' => array('ratings'=> <RATING>)
  +));
  +
  +// A user buys an item
  +$client->createEvent(array(
  +   'event' => 'buy',
  +   'entityType' => 'user',
  +   'entityId' => <USER ID>,
  +   'targetEntityType' => 'item',
  +   'targetEntityId' => <ITEM ID>
  +));
  +
  +?>
  +```
  +  </div>
  +  <div data-tab="Ruby SDK" data-lang="ruby">
  +(TODO: UPDATE ME)
  +```ruby
  +# Create a client object.
  +client = PredictionIO::EventClient.new(<ACCESS KEY>, <URL OF EVENTSERVER>)
  +
  +# A user rates an item.
  +client.create_event(
  +  'rate',
  +  'user',
  +  <USER ID>, {
  +    'targetEntityType' => 'item',
  +    'targetEntityId' => <ITEM ID>,
  +    'properties' => { 'rating' => <RATING (float)> }
  +  }
  +)
  +
  +# A user buys an item.
  +client.create_event(
  +  'buy',
  +  'user',
  +  <USER ID>, {
  +    'targetEntityType' => 'item',
  +    'targetEntityId' => <ITEM ID>
  +  }
  +)
  +```
  +  </div>
  +  <div data-tab="Java SDK" data-lang="java">
  +(TODO: UPDATE ME)
  +```java
  +import io.prediction.Event;
  +import io.prediction.EventClient;
  +
  +EventClient client = new EventClient(<ACCESS KEY>, <URL OF EVENTSERVER>);
  +
  +// A user rates an item
  +Event rateEvent = new Event()
  +    .event("rate")
  +    .entityType("user")
  +    .entityId(<USER_ID>)
  +    .targetEntityType("item")
  +    .targetEntityId(<ITEM_ID>)
  +    .property("rating", new Float(<RATING>));
  +client.createEvent(rateEvent);
  +
  +// A user buys an item
  +Event buyEvent = new Event()
  +    .event("buy")
  +    .entityType("user")
  +    .entityId(<USER_ID>)
  +    .targetEntityType("item")
  +    .targetEntityId(<ITEM_ID>);
  +client.createEvent(buyEvent);
  +```
  +  </div>
  +  <div data-tab="REST API" data-lang="json">
  +```
  +# Create a new user
  +
  +curl -i -X POST <URL OF EVENTSERVER>/events.json?accessKey=<ACCESS KEY> \
  +-H "Content-Type: application/json" \
  +-d '{
  +  "event" : "$set",
  +  "entityType" : "user"
  +  "entityId" : <USER ID>,
  +  "eventTime" : <TIME OF THIS EVENT>
  +}'
  +
  +# Create a new item or set existing item's categories
  +
  +curl -i -X POST <URL OF EVENTSERVER>/events.json?accessKey=<ACCESS KEY> \
  +-H "Content-Type: application/json" \
  +-d '{
  +  "event" : "$set",
  +  "entityType" : "item"
  +  "entityId" : <ITEM ID>,
  +  "properties" : {
  +    "categories" : ["<CATEGORY_1>", "<CATEGORY_2>"]
  +  }
  +  "eventTime" : <TIME OF THIS EVENT>
  +}'
  +
  +# A user views an item
  +
  +curl -i -X POST <URL OF EVENTSERVER>/events.json?accessKey=<ACCESS KEY> \
  +-H "Content-Type: application/json" \
  +-d '{
  +  "event" : "view",
  +  "entityType" : "user"
  +  "entityId" : <USER ID>,
  +  "targetEntityType" : "item",
  +  "targetEntityId" : <ITEM ID>,
  +  "eventTime" : <TIME OF THIS EVENT>
  +}'
  +
  +```
  +  </div>
  +</div>
  +
  +
   ## Sample Data for Quick Start
   
  -For demonstration purpose, a python script is provided to import sample data for quick start. It imports 10 users (with user ID "u1" to "u10") and 50 items (with item ID "i1" to "i50") with some random assigned categories ( with categories "c1" to "c6"). Each user then randomly view 10 items.
  +For demonstration purpose, a python script is provided to import sample data. It imports 10 users (with user ID "u1" to "u10") and 50 items (with item ID "i1" to "i50") with some random assigned categories ( with categories "c1" to "c6"). Each user then randomly view 10 items.
   
   First, make sure you are under the `MySimilar` directory. Execute the following to import the data (Replace the value of access_key parameter by your **Access Key**):
   
  
positive.code: {"itemScores":[{"item":"i21","score":1.1153550716504106},{"item":"i26","score":1.0773502691896257}]}
  ```
  
  Only recommend items not in the blackList:
  
  ```
  curl -H "Content-Type: application/json" \
  -d '{
    "items": ["i1", "i3"],
    "num": 10, "categories" : ["c4", "c3"],
    "blackList": ["i21", "i26", "i40"]
  }' \
  http://localhost:8000/queries.json
  
negative.code: 
  ## Advanced Query
  
  Recommend items which are similar to multiple items:
  
  ```
  curl -H "Content-Type: application/json" \
  