3

We are presenting lists of products to our users. Users can buy products. We have about 100 000 products. Users are watching only two or three pages of products. It's important to show best products on the first two pages. We are saving to database that user saw product and bought it. So we can count something like bought rate:

BR = (how many times product was bought) / (how many times product was seen)

The higher BR the higer product is on products list so more users will see it.

Everyday we are integrating new products and very often we are showing on the first page products bought once and seen once. We know that other products for example bought 10 times and seen 10 000 times are match better. It is rather coincidence that product has BR ~= 1 and BR will be much worst within few days.

How to count how important is BR? Now we know that 1/1 is not very important but we are looking for more mature solution how to count it.

It would be great if we could get some help with this.

4n4831
  • 33

1 Answers1

2

This sounds like a Beta-Binoimial purchase rate model would be useful. The link has a lot of details on this, but I'll give the salient highlights:

  1. We are assuming that when a product $i$ is introduced, we are uncertain as to its actual bought rate $BR_i$. We model this uncertainty with a beta distribution on [0,1]. For example, the uniform distribution on [0,1] is a member of the beta family of distributions.
  2. As the data roll in, you will get updates on the number of views, $n_i$ and the number of buys $x_i$ for each product $i$.
  3. Use this data to derive a "shrinkage estimate" of the bought rate. The details are well spelled out in the link and are too long to reproduce here. However, I've snipped the key equations from the wiki article and placed them below:

enter image description here

  1. These estimates will prevent over-weigting of "chance" occurrances such as 1 look - 1 buy, which are spurious and over-estimate the actual BR (and vice versa for 1 look, no buy).

Now, what about deciding which products to show? Since your product mix changes a lot, I would suggest considering a semi-randomized method of displaying products.

  1. Rank all your products by estimated BR (using all current data and the beta-binomial model)
  2. Add up the estimated BR for all products, and divide each BR by this sum. This will create a empirical distribution based on the current BR estimates.
  3. When a user starts viewing pages, you will want to populate the pages by selecting, without replacement, from the distribution you created in (2).
  4. Periodically re-evaluate your estimates based on current data.

This will both prevent over/under estiamtes based on only a few results and will give new products a chance to be seen and further evaluated.

Anyway, just suggestions. Hope it helps.


Specific example:

Lets say you have N products on your website. The number of times a product $i$ has been viewed is $v_i$, and the number of times bought is $b_i$. Therefore the naive estimate of the bought rate is $\frac{b_i}{v_i}$. However, this will lead to erratic results for new products. Instead, we will adjust this estimate using the beta-binomial model.

  1. Calculate the "grand mean" bought rate of all your products: $\hat \mu = \frac{\sum b_i}{\sum v_i}$. What we are doing here is creating an "anchor" for the observed bought rates. The remaining calculations will determine how far away from this mean rate we should allow each product's BR estimate to get.
  2. Calculate "Grand variance":

enter image description here

Where $\hat \theta_i = \frac{b_i}{v_i}$

Almost done....

  1. We are going to use our estimates of $\hat \mu$ and $s^2$ to calculate $\widehat M$, which determines how much weight we will give to $\hat \theta_i$ vs $\hat \mu$ in our estimate of the bought rate.

enter image description here

  1. Once you have $\widehat M$, you have everything you need to estimate your bought rates, given the data. This will result in a "shrinkage factor" for product $i$:

$\widehat B_i = \frac{\widehat M}{\widehat M + v_i}$

Putting all this together, our revised estimate of the bought rate for product $i$ is:

$BR_i = \widehat B_i \hat \mu + (1-\widehat B_i)\frac{b_i}{v_i}$

  • Thank You! I will try to understand it. If there will be no better answer till monday i will mark it as answer. – 4n4831 Sep 18 '14 at 13:59
  • Sorry but it's too difficult for me. I have no idea how to estimate BR for each product and count this shrinkage estimate. I suppouse it is to much to ask but i need some example with 3 or 4 products. I could then transform this example into some code. I see the point but it is too much math for me. I found this binomial probability example but still don't know how to estimate BR. – 4n4831 Sep 19 '14 at 12:16
  • @4n4831 I added a step-by-step explanation. The basic idea is that we assume all products start with the same BR (which is set to the total number of products bought divided by the total number of times the products were viewed). We then determine how far we should "pull" each product's BR from this overall mean. The shrinkage factor is what does this. Once you have the shrinkage factor, you are essentially just calculating a weighted average of the grand mean BR and the product-specific BR. –  Sep 19 '14 at 12:57
  • This is what i was looking for. Last and probably the most stupid question. What is the meaning of "n" in grand variance and M calculations? – 4n4831 Sep 19 '14 at 13:15
  • @4n4831 Sorry, was coping and pasting to avoid having to retype....$N$ is the number of products, and "little n" is just the number of times the product $i$ was viewed: $n_i=v_i$, i just didn't edit the jpeg. –  Sep 19 '14 at 13:34
  • I'm starting implementation. Amazing. Thank You! – 4n4831 Sep 19 '14 at 13:40
  • @4n4831 No problem - feel free to add comments if you have additional questions related to this. Also, I'd be interested to know how the "random" listing part works too, where you randomly select products w/o replacement using their estimated BR's to determine the probability of being selected. –  Sep 19 '14 at 13:47
  • I'm still thinking about finding shortest path to find best products to show on first pages. Now i'm showing this with best BR at the top. Products with accidentally high BR will lost it after few hours and some other will have place to show up. – 4n4831 Sep 19 '14 at 14:13
  • @4n4831 we have implemented your solution and we see that new BRi is not much different from simple BR=[number of buys]/[number of views]. Our problem is similar to determining if coin is fair. We would like to know if BR is important and how many times should be seen to be sure that BR is correct. – 4n4831 Sep 23 '14 at 10:13
  • @4n4831 not to be pedantic, but you can never be sure. However, if your adjusted BR is essentially the same as your BR, then that means that you have enough data to make a conclusion. This shouldn't be happening with small $n$ values, though. –  Sep 24 '14 at 04:28