Hi,

Assuming that you are using the Universal Recommender Engine, you should have a 
look at the "Queries" section here: 
https://github.com/PredictionIO/template-scala-parallel-universal-recommendation#queries


Try this request instead, where the "fields" property is used to filter by 
category


{
"user": "674296",
"num": 10,
"fields": [
{
"name": "categories",
"values": ["CAT1", "CAT2"],
"bias": -1
}
 ]
}

/magnus


________________________________
From: Hossein Bahrami <h.bahr...@live.com>
Sent: Tuesday, December 13, 2016 10:55:00 AM
To: user@predictionio.incubator.apache.org
Subject: Customizing Recommender engine

Dear all,

I'm new to Predictionio, currently I'm using it and I managed to import (rate, 
buy) events and getting pretty good results querying it. But now I want to 
limit the results for items in specific categories. I've created events for 
items' properties (categories) as well .

I am posting this query to engine but it seems doesn't care about the 
categories and returns same result every time.

{ "user": "674296", "num": 10, "categories" : ["CAT2", "CAT1"] }

I've imported bellow events

client.create_event(event="rate",
entity_type="user",
entity_id=int(row['userid']),
target_entity_type="item",
target_entity_id=int(row['itemid']),
properties= { "rating" : float(row['rating']) });

client.create_event(
event="buy",
entity_type="user",
entity_id=int(row['userid']),
target_entity_type="item",
target_entity_id=int(row['itemid']), );

client.create_event(
event="$set",
entity_type="item",
entity_id=itemid,
properties= { "categories": itemcats }
);

Could someone give me a solution or hint to how customize this recommender 
engine to take the categories into account.

Thanks in advance
Hossein

Reply via email to