“People who watched this also watched” algorithm

后端 未结 5 981
攒了一身酷
攒了一身酷 2021-02-14 03:45

I am trying to code an algorithm that acts a bit like Amazon\'s \"People who bought this also bought\".

The difference between the two is that mine is just counting the

5条回答
  •  不要未来只要你来
    2021-02-14 04:36

    Ok. I think i figured it out. part of the work is code implementation.

    What i did was to group by the sessionID, productID. then, in my code I iterate thought each sessionID, and I make a dictionary with pairs. for instance, if I have pid 10 and 20 and 30, which are a clique basically. so I insert to the dictionary in the following way: 1. 10-20, weight 1 2. 20-10, weight 1 3. 10-30, weight 1 4. 30-10, weight 1 5. 20-30, eight 1. 6. 30-20, weight 1.

    in case I encounter one of the values again, i will add +1 to the appropriate pair/s.

    at the end, i will have the weights and pairs aligned.

    all I have to do now is by a given productID, to scan the table and find the clique it is inside.

    if you have improvements suggestions, please let me know!

    thanks all!

提交回复
热议问题