How to calculate the best step for a prices range of multiple products' prices?

65 Views Asked by At

Assume that I have N products with thier prices. ${P1, P2, P3, ..., Pn}$. I have the maximum price $Pmax$ and the minimum price $Pmin$ .

I want to calculate the best steps to quantize this interval of prices. The normal step which equals $(Pmax-Pmin)/no ofsteps$ would give a lot of errors.

Example: Assume I have 15 products, 14 of them have the prices between 1000-2000\$, but the last one is 20000\$. The normal step would be 1000$ for 15 steps, but this would give me 14 products in a single step and 8 steps with no products and the final step with one product.

I think that the steps distibution should be non-normal.

I think the idea is in dividing the dense sub-intervals with smaller steps and the less dense sub-intervals with bigger steps.

But what is the secret formula which would give the steps $S1, S2, S3, ..., Sm$ which would give the best distribution.

1

There are 1 best solutions below

2
On

"Best" leaves a lot to interpretation here, and it depends on what you're trying to accomplish.

From a practical standpoint, $15$ products isn't a lot. I'd question whether you need to bin them at all by price (assuming you want to create a catalog on a website, for example). $150$ products? Probably. $1,500$? Definitely.

If you want equal binning into (say) three bins, then choose your ranges to include the bottom third by price, the middle third, and the top third.

If you want to highlight your more expensive products, then make those bins include fewer products (so they all appear on one page).

Or, perhaps the $\$20,000$ product really shouldn't be binned with the other products that are $\$2,000$ or less. Then the problem goes away and you can use the linear binning formula you mentioned in your question without much trouble.