predictionio-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno LEBON <b.le...@redfakir.fr>
Subject Items blacklisted in the query made to Elasticsearch by UR
Date Thu, 30 Mar 2017 15:57:43 GMT
Hello,

We test the universal recommender on a cluster made following the tutorial
from actionML. Once the build/train/deploy is done we send PIO a request to
get recommendation.
For example:
*curl -H "Content-Type: application/json" -d '{ "user":
"4e810ef4-977a-4f04-b585-cf2c2996ec93", "num": 11 }'
http://localhost:8001/queries.json <http://localhost:8001/queries.json>*

In the pio.log we see the requests made to Elasticsearch. They look like:
*{"size":11,"query":{"bool":{"should":[{"terms":{"facet":["estag_begin-couleur-noir-estag_end","cocooning","sexy","charme","estag_begin-taille-105h-estag_end","estag_begin-taille-4-estag_end","estag_begin-primadonna-estag_end","transparent","estag_begin-aubade-estag_end","estag_begin-couleur-rouge-estag_end","une-piece","estag_begin-simone-perele-estag_end","maintien","moins-de-20-euros-intervalle-de-prix","estag_begin-taille-taille-unique-estag_end","estag_begin-moins-50-pour-cent-estag_end","elasthanne","blouse","body","coque","string","slip","estag_begin-taille-95a-estag_end"]}},{"terms":{"view":[]}},{"constant_score":{"filter":{"match_all":{}},"boost":0}}],"must":[],"must_not":{"ids":{"values":["estag_begin-taille-95a-estag_end","string","estag_begin-aubade-estag_end","slip","elasthanne","coque","body","blouse","estag_begin-moins-50-pour-cent-estag_end","estag_begin-primadonna-estag_end","estag_begin-taille-taille-unique-estag_end","moins-de-20-euros-intervalle-de-prix","maintien","estag_begin-simone-perele-estag_end","une-piece","estag_begin-couleur-rouge-estag_end","transparent","sexy","estag_begin-taille-4-estag_end","estag_begin-taille-105h-estag_end","charme","cocooning","estag_begin-couleur-noir-estag_end"],"boost":0}},"minimum_should_match":1}},"sort":[{"_score":{"order":"desc"}},{"popRank":{"unmapped_type":"double","order":"desc"}}]}*

The important part is the fact that there is a must_not that is not empty.
We want it to be empty, we have the following engine.json:
*{*
*  "comment":"",*
*  "id": "default",*
*  "description": "settings",*
*  "engineFactory": "org.template.RecommendationEngine",*
*  "datasource": {*
*    "params" : {*
*      "name": "sample-handmade-data.txt",*
*      "appName": "piourcluster",*
*      "eventNames": ["facet","view"]*
*    }*
*  },*
*  "sparkConf": {*
*    "spark.serializer": "org.apache.spark.serializer.KryoSerializer",*
*    "spark.kryo.registrator":
"org.apache.mahout.sparkbindings.io.MahoutKryoRegistrator",*
*    "spark.kryo.referenceTracking": "false",*
*    "spark.kryoserializer.buffer": "300m",*
*    "es.index.auto.create": "true",*
*    "es.nodes":"espionode1:9200,espionode2:9200,espionode3:9200"*
*  },*
*"algorithms": [*
*    {*
*      "name": "ur",*
*      "params": {*
*        "appName": "piourcluster",*
*        "indexName": "urindex",*
*        "typeName": "items",*
*        "eventNames": ["facet", "view"],*
*        "blacklistEvents": [[]],*
*        "maxEventsPerEventType": 50000,*
*        "maxCorrelatorsPerEventType": 50,*
*        "maxQueryEvents": 100,*
*        "num": 11,*
*        "rankings": [*
*          {*
*            "name": "popRank",*
*            "type": "popular"*
*          }*
*        ],*
*        "returnSelf": true*
*      }*
*    }*
*  ]*
*}*

>From what we understand the fact that we have an array containing an empty
array for the parameter blacklistEvents tells UR that we don't want any
event to be blacklisted, not even the primary one.
We also added the parameter returnSelf : true to ask UR not to blacklist
any items part of the query.

So why do we have blacklisted events in our query (ie the must_not part of
it) ?

(Note that when we do a change in the engine.json and launch a deploy, we
see in the log some parameters value appearing, thus we know we modify the
right engine.json file.)

Regards
Bruno

Mime
View raw message