I want to get the most buying products of a user in the history. I'm currently using USER_PERSONALIZATION recipe, but GetRecommendations always returns wrong result. Please help.
This is my interaction data for the user id: f5504cb0-0f0e-11e9-b513-bb78938fd0f8
, he/she purchased 10 times and he/she didn't not purchase the product with id 1A3DTA986EEBT
And this is my code and the result
As you see, the top product is not the product which he/she purchased. Thank for your help.
Amazon Personalize builds machine learning based recommenders based on your data. Therefore it's designed to predict what a user would be interested in now based on their past behavior (interactions) and the attributes of the items/products they've interacted with. Some considerations:
Although you can import purchase history into Personalize, it's not designed as a datastore that you can query. If you simply want a list of the most commonly purchased products for a user, a database is likely a better tool to use. For example, to get the top 10 most purchased products for user someuser
from a relational database where orders are stored in Order
and OrderDetail
tables, the SQL might look something like this:
SELECT od.ItemID, COUNT(*) AS PurchaseCount
FROM Order AS o, OrderDetail AS od
WHERE o.UserID = 'someuser'
AND o.OrderID = od.OrderID
GROUP BY ItemID
ORDER BY PurchaseCount DESC
LIMIT 10
If you're use case is more like, "given a user's recent purchases, what would they likely be interested in purchasing again", Personalize can be used. Here are the general steps.
USER_ID
, ITEM_ID
, TIMESTAMP
, and EVENT_TYPE
.ITEM_ID
, purchase date would be TIMESTAMP
, and something like "Purchase" would be the EVENT_TYPE
.aws-user-personalization
recipe.INCLUDE ItemID WHERE Interactions.EVENT_TYPE IN ("Purchase")
.GetRecommendations
API for the campaign with the filter created above.One important caveat is that when filtering on interactions history, Personalize currently only considers the most recent 200 historical interactions (in the bulk import) and most recent 100 for real-time events (sent in via the PutEvents
API) for each user.