I am training a supervised machine learning model.
The training data contains 2 independent groups of people. The dataset contains independent continuous variables and 1 dependent binary variable.
I want to select the optimal number of bins to use for each independent variable. I define the optimal number of bins as the number of bins that will highlight the largest difference in counts between my binary y variables.
I am aware of Sturge’s and Freedman-Diaconis rules. However, to my knowledge, these approaches do not select the number of bins based on their ability to parcellate the dependent variable groups per bin.
If I were to do this manually, I would divide the data using 2-15 bins. Then, I would plot histograms of each. Finally, I would eyeball the number of bins. The histogram that showed the greatest difference between the two dependent variable groups, for a particular bin range, is the number of bins I would use.
I am looking for an equation/ test, similar to Sturge’s and Freedman-Diaconis rules, that can do this. Alternatively, if there is a more optimal, and straightforward, approach I would gladly consider this also.