Skip to content

Commit 1ca3a36

Browse files
committed
added to the integration test, dateRange query fixed in script, docs updated
1 parent b857207 commit 1ca3a36

File tree

5 files changed

+47
-25
lines changed

5 files changed

+47
-25
lines changed

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ The query returns personalized recommendations, similar items, or a mix includin
262262
},{
263263
“name”: “genre”,
264264
“values”: [“sci-fi”, “detective”]
265-
“bias”: 0.2 // boost/favor recommendations with the `genre’ = `sci-fi` or ‘detective’
265+
“bias”: 1.02 // boost/favor recommendations with the `genre’ = `sci-fi` or ‘detective’
266266
}
267267
]
268268
}
@@ -282,7 +282,7 @@ When the a date is stored in the items properties it can be used in a date range
282282
},{
283283
“name”: “genre”,
284284
“values”: [“sci-fi”, “detective”]
285-
“bias”: 0.2 // boost/favor recommendations with the `genre’ = `sci-fi` or ‘detective’
285+
“bias”: 1.02 // boost/favor recommendations with the `genre’ = `sci-fi` or ‘detective’
286286
}
287287
],
288288
"dateRange": {
@@ -308,8 +308,7 @@ When setting an available date and expire date on items, the current date can be
308308
},{
309309
“name”: “genre”,
310310
“values”: [“sci-fi”, “detective”]
311-
“bias”: 0.2 // boost/favor recommendations with the `genre’ = `sci-fi` or ‘detective’
312-
}
311+
“bias”: 1.02 }
313312
],
314313
"currentDate": "2015-08-15T11:28:45.114-07:00"
315314
}
@@ -328,14 +327,22 @@ When setting an available date and expire date on items, the current date can be
328327
},{
329328
“name”: “genre”,
330329
“values”: [“sci-fi”, “detective”]
331-
“bias”: 0.2 // boost/favor recommendations with the `genre’ = `sci-fi` or ‘detective’
330+
“bias”: 1.02 // boost/favor recommendations with the `genre’ = `sci-fi` or ‘detective’
332331
}
333332
]
334333
}
335334

336335
This returns items based on user xyz history or similar to item 53454543513 but favoring user history recommendations. These are filtered by categories and boosted to favor more genre specific items.
337336

338-
**Note**:This query should be considered **experimental**. mixing user history with item similarity is possible but may have unexpected results.
337+
**Note**:This query should be considered **experimental**. mixing user history with item similarity is possible but may have unexpected results. If you use this you should realize that user and item recommendations may be quite divergent and so mixing the them in query may produce nonsense. Use this only with the engine.json settings for "userbias" and "itembias" to favor one over the other.
338+
339+
340+
###Popular Items
341+
342+
{
343+
}
344+
345+
This is a simple way to get popular items. All returned scores will be 0 but the order will be based on relative popularity. Field-based biases for boosts and filters can also be applied.
339346

340347
##Events
341348
The Universal takes in potentially many events. These should be seen as a primary evnet, which is a very clear indication of a user preference and secondary events that we think may tell us something about user "taste" in some way. The Universal Recommender is built on a distributed Correlation Engine so it will test that these secondary events actually relate to the primary one and those that do not correlate will have little or no effect on recommendations (though they will make it longer to train and get query results). It is recommended that you start with one ot two events and increase the number as you see how these events effect results and timing.
@@ -402,6 +409,13 @@ To begin using new data with an engine that has been used with sample data or us
402409

403410
## Versions
404411

412+
### v0.2.2
413+
414+
- a query with no item or user will get recommendations based on popularity
415+
- a new integration test has been added
416+
- a regression bug where some ids were being tokenized by Elasticsearch, leading to incorrect results, was fixed. **NOTE: for users with complex ids containing dashes or spaces this is an important fix.**
417+
- a dateRange in the query now takes precidence to the item attached expiration and avaiable dates.
418+
405419
### v0.2.1
406420

407421
- date ranges attached to items will be compared to the prediction servers current data if no date is provided in the query.

data/integration-test-expected.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,9 @@ Recommendations for no user no item, all from popularity, Tablets boost, Estados
8383
Recommendations for user: u1
8484

8585
{"itemScores":[{"item":"Surface","score":0.049329958856105804}]}
86+
87+
============ query with item and user *EXPERIMENTAL* ============
88+
89+
Recommendations for no user no item, all from popularity, Tablets boost, Estados Unidos Mexicanos filter
90+
91+
{"itemScores":[{"item":"Galaxy","score":1.3019405603408813},{"item":"Nexus","score":0.5091257691383362},{"item":"Surface","score":0.04033438116312027}]}

examples/integration-test

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,13 @@ echo ""
6565
echo "Running test query."
6666
./examples/multi-query-handmade.sh > test.out
6767

68+
echo ""
69+
echo "Restoring engine.json"
70+
mv user-engine.json engine.json
6871

6972
echo ""
7073
echo "Differences between expected and actual results, none is a passing test:"
7174
diff data/integration-test-expected.txt test.out
7275

73-
echo ""
74-
echo "Restoring engine.json"
75-
mv user-engine.json engine.json
76-
7776
echo ""
7877
echo "Note that the engine is still deployed until killed or this shell exists."

examples/multi-query-handmade.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,17 @@ curl -H "Content-Type: application/json" -d "
202202
}
203203
}" http://localhost:8000/queries.json
204204
echo ""
205+
206+
echo ""
207+
echo "============ query with item and user *EXPERIMENTAL* ============"
208+
# This is experimental, use at your own risk, not well founded in theory
209+
echo ""
210+
echo "Recommendations for no user no item, all from popularity, Tablets boost, Estados Unidos Mexicanos filter"
211+
echo ""
212+
curl -H "Content-Type: application/json" -d '
213+
{
214+
"user": "u1",
215+
"item": "Iphone 4"
216+
}' http://localhost:8000/queries.json
217+
echo ""
218+

examples/single-query-handmade.sh

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
#!/usr/bin/env bash
22

3-
4-
echo ""
5-
echo "============ dateRange filter ============"
6-
echo ""
7-
BEFORE=`date -v +1d +"%Y-%m-%dT%H:%M:%SZ"`
8-
AFTER=`date -v -1d +"%Y-%m-%dT%H:%M:%SZ"`
9-
#echo "before: $BEFORE after: $AFTER"
103
echo "Recommendations for user: u1"
114
echo ""
12-
curl -H "Content-Type: application/json" -d "
5+
curl -H "Content-Type: application/json" -d '
136
{
14-
\"user\": \"u1\",
15-
\"dateRange\": {
16-
\"name\": \"date\",
17-
\"before\": \"$BEFORE\",
18-
\"after\": \"$AFTER\"
19-
}
20-
}" http://localhost:8000/queries.json
7+
"user": "u1"
8+
}' http://localhost:8000/queries.json
219
echo ""
10+

0 commit comments

Comments
 (0)