# supervised binning

I have continuous outcome variable and continuous independent variable. I am trying to bin the independent variable that maximizes homogeneity within bins based on the outcome and maximize separation. Is there any technique that would help this ?

• Could you tell us why you are trying to do this? If it's for regressing the outcome against the variable, there are better procedures requiring no binning at all. – whuber Aug 17 '16 at 17:21
• For example, we have past customer purchase count(1,2,3,4..etc) as independent variable and revenue from the customer in the next 365 days as dependent variable. We are trying to find meaningful way binning purchase count that accounts for outcome variable variance. – Naveenan Aug 17 '16 at 17:36
• Could you clarify then what it means to "maximize homogeneity within bins based on the outcome" and "maximize separation"? And what constraints are there (such as limits on the numbers or widths of bins)? – whuber Aug 17 '16 at 17:42
• As example relation between past purchase count and future revenue have a positive correlation. Let's assume we have two bins - [1,2] and [3,4] with mean revenue of the bins as $50 and$54. Even though average/mean is different between bins the distribution of the data/variance is high in these two bins(overlapping confidence interval/inter quartiles) so that it make sense to have these grouped as a single bin. Trying to achieve this. There is no limit on the numbers or width of the bins. – Naveenan Aug 17 '16 at 18:03
• Then the answer is to bin every one of the values of the independent variable individually. – whuber Aug 17 '16 at 18:07