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
435 stars 98 forks source link

Missing and Special bins added to index 0 with optb.transform #235

Closed chapmanh closed 1 year ago

chapmanh commented 1 year ago

Me again (apologies!),

As per the title:

example where Special is incorrectly aggregated into bin index 0: image

and for Missing as well: image

Note the totals of missing/special plus bin 0 match perfectly.

I have not found an instance in my work where I have Missing and Special in the same metric, but would Imagine that in the OptimalBinning class the binning_tables method is doing some pre-processing during or before building which the .transform method is not emulating before looking up the index of the bin and returning the index, so the first 'normal' bin, the Missing bin and the Special bin all return 0 within the transform method.

Thanks, H

guillermo-navas-palencia commented 1 year ago

Hi @chapmanh,

See https://github.com/guillermo-navas-palencia/optbinning/issues/169. Please read the documentation of the transform method.