We run an ecom that sells digital products all around the world.
Here is what we modeled so far.
We have 2 entities, "user" and "item".
The primary indicator that we are using is "buy",
{
"event" : "buy",
"entityType" : "user",
"entityId" : "
us...@example.com",
"targetEntityId" : "DigitalProduct1",
"eventTime" : ISODate("2023-06-09T08:59:16.512Z")
}
and for each "item" we record a "country_code" (ie: where the digital product can be used) and a "category"
{
"event": "$set",
"entityType": "item",
"entityId": "DigitalProduct1",
"properties": {
"country_code": [
"US"
],
"category": [
"e-commerce"
]
},
"eventTime": "2023-06-10T07:43:22.129649945Z"
}
As the country where the user is buying from is often different from the "country_code" of the item, we also record a "location-pref" indicator
{
"event": "location-pref",
"entityType": "user",
"entityId": "
us...@example.com",
"targetEntityType": "item",
"targetEntityId": "DE",
"eventTime": "2023-06-10T07:40:46.501540121Z"
}
So, in this example
us...@example.com purchased "DigitalProduct1" from country "DE".
As our ecom can be accessed from different client apps, (think web browser, Android app, ios app,...) we also record a "app-pref" indicator
{
"event": "app-pref",
"entityType": "user",
"entityId": "
us...@example.com",
"targetEntityType": "item",
"targetEntityId": "mobile-app",
"eventTime": "2023-06-10T07:40:46.501540121Z"
}
The training model is like this:
"algorithm":{
"indicators": [
{"name": "buy"},
{"name": "location-pref", "maxCorrelatorsPerItem": 10},
{"name": "app-pref", "maxCorrelatorsPerItem": 2}
],
"maxEventsPerEventType": 500000,
"maxCorrelatorsPerEventType":500,
"blacklistIndicators": [],
"rankings": [
{
"type": "popular",
"duration": "90 days"
}
]
}
We trained the model with some real data, about 250k events and 1000 items.
Now the questions :)
1 - when a user lands on the homepage, the only thing we assume to know is the country (from the IP address), ie the "location-pref"
Here we already show to the users the "items" from our catalog according to the "country_code". IE: to a user from DE we show items with country_code:DE
But as i mentioned, users from a country often shop for items for a different country_code, so we want to recommend items using a query based on "location-pref",
also considering the "app-pref", something like:
"rules":[{"name":"location-pref", "values":["DE"], "bias":-1}, {"name":"app-pref", "values":["none"], "bias":-1}]
The result of this query is a bit strange, or let's say it's not want we want: it seams that the algorithm is just sorting the items by global popularity and filter them for "location-pref".
For example, items that are sold a lot all over the world, but that have been purchased from "DE" just a few times, are ranked top,
well before items that are top seller from "DE".
How to get the "top seller from DE" items ranking first?
2 - when a user is then logged in, we want to make some specific recommendation for him. As mostly of the users are returnig and buying the same few items,
we want to recommend the previous purchased items first, and then some other products the user can like.
We are using query like: "user": "
us...@example.com", but again the results are not what we expected. How to have the the previous purchased items ranked first?
Thank you.