There is no direct way to do cross validation with unallocated discretization in scikit, but there are two workarounds:
1.
Use StratifiedCrossValidation to achieve cross-validation with the distribution in each roll-up, reflecting the distribution of data, then you can reduce the imbalance in the classifiers using the class_weight parameter, which can either take auto or defective / over-fulfilled classes inversely to their score, or you can pass dictionary with explicit weight.
2.
Write your own cross-reference validation procedure, which should be fairly simple using pandas .
source share