| # Recommendation Template support categories filtering |
| |
| ## Documentation |
| |
| The data requirement is similar to "Similar Product Template". Please see. |
| http://docs.prediction.io/templates/similarproduct/quickstart/ |
| |
| By default, view events and MLlib ALS trainImplicit is used. |
| |
| The main difference is: |
| |
| Query by user Id instead of list of item Ids. |
| |
| ## Development Notes |
| |
| ### import sample data |
| |
| ``` |
| $ python data/import_eventserver.py --access_key <your_access_key> |
| ``` |
| |
| ### query |
| |
| normal: |
| |
| ``` |
| $ curl -H "Content-Type: application/json" \ |
| -d '{ |
| "user" : "u1", |
| "num" : 10 }' \ |
| http://localhost:8000/queries.json \ |
| -w %{time_connect}:%{time_starttransfer}:%{time_total} |
| ``` |
| |
| ``` |
| $ curl -H "Content-Type: application/json" \ |
| -d '{ |
| "user" : "u1", |
| "num": 10, |
| "categories" : ["c4", "c3"] |
| }' \ |
| http://localhost:8000/queries.json \ |
| -w %{time_connect}:%{time_starttransfer}:%{time_total} |
| ``` |
| |
| ``` |
| curl -H "Content-Type: application/json" \ |
| -d '{ |
| "user" : "u1", |
| "num": 10, |
| "whiteList": ["i21", "i26", "i40"] |
| }' \ |
| http://localhost:8000/queries.json \ |
| -w %{time_connect}:%{time_starttransfer}:%{time_total} |
| ``` |
| |
| ``` |
| curl -H "Content-Type: application/json" \ |
| -d '{ |
| "user" : "u1", |
| "num": 10, |
| "blackList": ["i21", "i26", "i40"] |
| }' \ |
| http://localhost:8000/queries.json \ |
| -w %{time_connect}:%{time_starttransfer}:%{time_total} |
| ``` |
| |
| unknown user: |
| |
| ``` |
| curl -H "Content-Type: application/json" \ |
| -d '{ |
| "user" : "unk1", |
| "num": 10}' \ |
| http://localhost:8000/queries.json \ |
| -w %{time_connect}:%{time_starttransfer}:%{time_total} |
| ``` |