# Best way to split real valued imbalanced distribution into finite number of classes

What I'm trying to do is adapting this research paper to another problem. In short: the authors split price variations of S&P500 index into four different classes. Then they train a Random Forest in order to predict open-close return on previously unseen data. Their approach is successful considering that they've eventually managed to systematically overperform the index. However, price fluctuations of that index are pretty balanced across classes as you can see from the figure below:

For the asset which price variations I'm trying to predict, however, the situation is really different. I'm attaching its distribution below.

As you can see, my data is extremely unbalanced. So far my random forest has achieved a pretty decent AUROC, my micro-average across classes is 0.77. However, as you could easily imagine, most of the predictions made are about that immense number of variations around zero. What I want to do is finding a way to scientifically split data into a number of classes that is sufficiently sparse to assign pretty much the same number of data points to each class as the authors did in their paper. How would you suggest me to procede?

• What is the statistical principle upon which this strategy is based? And note that concordance probability (AUROC) does not need balance. – Frank Harrell May 30 '19 at 11:43
• @FrankHarrell, I'm not completely sure about what you exactly refer to when you say "statistical principle"... – Andrey E. Vedishchev Jun 1 '19 at 15:48
• I mean does the strategy respect the information collected, e.g., no binning of continuous variables, and has the strategy been either validated theoretically or by simulation? I ask this because it seems ad hoc. – Frank Harrell Jun 1 '19 at 21:23
• @FrankHarrell, the price variations - which are continuous variables - have been binned by the authors in four different categories: {1, 2, 3, 4}. Every category, in their original paper, contains pretty much the same number of occurrences. Their strategy has been validated by a backtest and, in the period taken into consideration, they actually overperformed the benchmark. However it should be pointed out that they haven't included transaction costs nor front running in their simulation. – Andrey E. Vedishchev Jul 4 '19 at 7:39
• The classes are not valid. They are arbitrary and most importantly throw away information and ignore close calls (changes near those boundaries). The categories also fail to recognize that a change of +x% is not balanced by a change of -x% because % changes is an asymmetric measure. – Frank Harrell Jul 4 '19 at 12:47