Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest adding float ranges in binning_table.build result #349

Open
chengs opened this issue Feb 28, 2025 · 1 comment
Open

Suggest adding float ranges in binning_table.build result #349

chengs opened this issue Feb 28, 2025 · 1 comment
Assignees

Comments

@chengs
Copy link

chengs commented Feb 28, 2025

In such code

optb = OptimalBinning(name='example', dtype='numerical', solver='cp')
optb.fit(X, y)
binning_table = optb.binning_table
bins = binning_table.build()
print(bins)

binning_table.build method returns a pandas.DataFrame as follows:

Image

This dataframe actually can be used more than display, with other format, such as JSON.
For example, with this table, one can build a transform function converting values into WoE, in other language/platform (C, tensorflow, java etc)

Therefore, I would suggest that, the range of each bin can be saved in their raw float values, and then this build api can be modified to accept a format property (or add a new build_json api).

If this is reasonable to you, I am happy to make a PR.

@chengs chengs changed the title Add float ranges in binning_table.build result Suggest adding float ranges in binning_table.build result Feb 28, 2025
@guillermo-navas-palencia
Copy link
Owner

Hi @chengs. The suggested feature might be already covered by #96. See https://gnpalencia.org/optbinning/binning_binary.html#optbinning.OptimalBinning.to_json. Would this suffice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants