I have a dataset of articles metadata for each article, so something like this:
product_id | color | type |
---|---|---|
1234 | red | t-shirt |
and another containing the transactions of customers, which looks like this:
date | customer_id | product_id |
---|---|---|
12/12/12 | abcd | 1234 |
Using the second dataset, I was able to determine which products are often bought together. As such, for each product, I have a sorted list of 10 (different) products (at most, it could be less) that are most frequently bought with it. This information is stored in a dictionary of the following form:
{1234: [5678,6352,3434,34433, ...], 1435 : [7832, 9801, 1234], ...}
My question is the following. Is there a way for me to create embeddings of products such that a given product is "close" to the products it is most frequently bought with ? In other words, I want to cluster articles that are bought together in a space and have vectors (embeddings) for each product.
Why would I want to do this ?
- To see if I can see an interesting structure in my data
- To recommend items to users, I can look for the k-nearest neighbors of the users' latest purchases
It looks to me like it is some form of supervised clustering (if that even makes sense), but I can't exactly find how I would go about doing this.
If you could point to me towards an algorithm or something I am missing here, please let me know.