Creating a list of "People who viewed this also viewed"

I’m going to create the “People who viewed this list” list that you see on Amazon, screech, and other online sites. Now I am going to create a new table with "product_id", "last_viewed_product_id", "hits", where when the user goes from the page for product_id = 100 to product_id = 101, he will create / update this table with product_id = 101, last_viewed_product_id = 100 and increase the value of "hits". Are there more efficient methods that are more optimized and less intensive in the computing area?

+6
source share
4 answers

Best of all, I know that the “tricks” Amazon uses to make things less computationally intensive are: a) use Bayesian statistics / averages and b) calculate partial aggregates. The latter allows you not to need to read everything (instead, you can sum the pre-computed aggregates). The first allows you to enter what you mean will be related material.

+4
source

It seems you are on the right track - a few suggestions -

For intensive computing, you probably want to cache your results, so you only get the top “x” number, which is updated once a day or similar to this effect. In this case, the real time does not seem significant.

I'm not sure what products you have on your site, but if the variety is significant, you might want to put items that have related information in order to display (so Star Wars only had Star Wars related items popping up).

So, if you have “tags” for your products or keywords, you can use relationships with them.

You may also want to create weight by how they got to the product. If they got to the product by clicking on the list that you provided, then these types of items will continue to fill up and not give other products a chance to appear, so give it a little weight. Instead, heavier elements will appear.

+4
source

If you have user IDs for all your visitors (you can create temporary ones for unregistered users), you can create a history table with the user_id and product_id columns, which stores all users who visited the products. Then, when a user opens a product, run a query that searches for user_users who have recently viewed this product, and then attach it to the products that these users opened. Then simply select the products that were most open by these user_id.

Be sure to loop this, as the connection will slow down any SQL server.

+2
source

I'm sure Amazon uses the Association Rules to do this.

Main article:

http://dl.acm.org/citation.cfm?id=170072

Fast Algorithm (FP-Growth):

http://link.springer.com/chapter/10.1007/3-540-47887-6_34#page-1

I have not seen the PHP library, but there is for Java, Python.

+1
source

Source: https://habr.com/ru/post/888598/


All Articles