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

Attribute error in Continuous Optimal binning #340

Open
villelliv opened this issue Oct 30, 2024 · 1 comment
Open

Attribute error in Continuous Optimal binning #340

villelliv opened this issue Oct 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@villelliv
Copy link

I get the following Attribute error:
File "...\Python\Python312\site-packages\optbinning\binning\continuous_binning.py", line 441, in fit
return self._fit(x, y, sample_weight, check_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\Python\Python312\site-packages\optbinning\binning\continuous_binning.py", line 660, in _fit
n_zeros] = self._fit_prebinning(
^^^^^^^^^^^^^^^^^^^^^
File "...\Python\Python312\site-packages\optbinning\binning\binning.py", line 893, in _fit_prebinning
return self._prebinning_refinement(prebinning.splits, x, y, y_missing,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\Python\Python312\site-packages\optbinning\binning\continuous_binning.py", line 855, in _prebinning_refinement
self._max_target_special] = target_info_special_continuous(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\Python\Python312\site-packages\optbinning\binning\binning_statistics.py", line 200, in target_info_special_continuous
std_special.append(0)
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'append'

when using ContinuousOptimalBinning  with special codes as follows:
    optb = ContinuousOptimalBinning(name=factor, dtype='numerical', monotonic_trend='auto_asc_desc',max_n_bins=20,
                                            special_codes={'special_5': -5, 'special_6': -6,
                                                           'special_7': -7, 'special_9': -9})
 The error seems to occur in some cases, for example when no special values are present and only with continuous target. What could be the root cause of this?
 
 Thank you,
 Ville
@guillermo-navas-palencia
Copy link
Owner

Hi @villelliv. Thanks for notifying this issue. I will look into this.

@guillermo-navas-palencia guillermo-navas-palencia added the bug Something isn't working label Oct 30, 2024
@guillermo-navas-palencia guillermo-navas-palencia added this to the v0.21.0 milestone Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants