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
459 stars 100 forks source link

woe of the nulls is swapped with that of the special #325

Closed AffDk closed 4 months ago

AffDk commented 4 months ago

Hi, I am using BinningProcess to get the woe of a feature like X0 below.

binning = BinningProcess(X0.columns.to_list(), n_jobs=-1) binned_X0 = binning.fit_transform(X0, y_train, metric='woe')

if I plot the binning table, I get something like the following

image

so basically, any numeric value should get a woe of 1.27 and any null should get woe of -0.3.

however, if I retrieve the unique values of the binned_X0, I get [0, 1.27] so the woe of the numeric values are, as expected 1.27 but the woe of the null is given a zero which should have been assigned to special values of which I have none.

is this how it should behave or this is really unexpected?

Best regards, Afshin

guillermo-navas-palencia commented 4 months ago

See https://github.com/guillermo-navas-palencia/optbinning/issues/291#issuecomment-1864651049