guillermo-navas-palencia / optbinning

Optimal binning: monotonic binning with constraints. Support batch & stream optimal binning. Scorecard modelling and counterfactual explanations.
http://gnpalencia.org/optbinning/
Apache License 2.0
452 stars 100 forks source link

Modify check on split_digits to allow for negative numbers #319

Open ijwok opened 4 months ago

ijwok commented 4 months ago

Currently, there are checks in place that limit the use of split_digits to the range [0,8] in the OptimalBinning classes.

Is there any reason to not allow for negative numbers here, to allow for rounding to 10s/100s? The numpy.round implementation that is used will happily accept negative numbers to allow for rounding to powers of 10, e.g. numpy.round(1343.21,-2) == 1300.0.

As for the work required, if my understanding is correct the only thing that would need to be changed to allow for this is to adjust the check 0 <= split_digits <= 8 that is present in several parts of the code.

(N.B. this is the first issue I have ever raised, please let me know if this is the correct way of doing so)