Answer the question
In order to leave comments, you need to log in
How to select random items from db using mathematical probability based on each item's conversion?
I need 2 formulas:
1st will convert conversion rates to probability rates.
The 2nd one will determine the elements for issuance for each request based on the probability coefficients
. Who can tell? The task is solved for a site with the functionality of a directory on the PHP + MySQL stack. I put the details of the task under the spoiler.
Answer the question
In order to leave comments, you need to log in
You checkers or go? If this is for a diploma, then one thing. And if to solve a specific problem, then another.
Let's say you have an online clothing store and you want to show "similar products". In this case, it is easier to store links not between hundreds of thousands of products, but between a dozen categories. For example, when buying any jacket, offer a hat, scarf and gloves.
For a dozen connections, learning will happen fairly quickly. While it's happening - use plain rand() to select a related category and pick the top selling item in that category.
To speed up, use "training with a teacher", that is, you yourself (or hire a freelancer) select related categories.
Then you can improve further. For example, if a jacket is from the average price range (among jackets), then a hat is also offered from the average price range (among hats).
SELECT * FROM elements ORDER BY conversion*RAND() DESC LIMIT 10
0.1
0.3
0.2
0.5
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question