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

ValueError: not enough values to unpack (expected 8, got 3) #205

Closed
CarloNicolini opened this issue Oct 30, 2022 · 5 comments
Closed

ValueError: not enough values to unpack (expected 8, got 3) #205

CarloNicolini opened this issue Oct 30, 2022 · 5 comments
Assignees
Labels
bug Something isn't working
Projects
Milestone

Comments

@CarloNicolini
Copy link

I am using the ContinuosBinning with a number of categorical and numerical variables as X and a float bounded in [0,1] as y.
With some of the categorical variables I sometimes get the following error when fitting:

File ~/opt/miniconda3/envs/creditfactor/lib/python3.10/site-packages/optbinning/binning/continuous_binning.py:628, in ContinuousOptimalBinning._fit(self, x, y, check_input)
    623         [splits, n_records, sums, ssums, stds, min_t, max_t,
    624          n_zeros] = self._prebinning_refinement(
    625             user_splits, x_clean, y_clean, y_missing, x_special,
    626             y_special, y_others)
    627 else:
--> 628     [splits, n_records, sums, ssums, stds, min_t, max_t,
    629      n_zeros] = self._fit_prebinning(
    630         x_clean, y_clean, y_missing, x_special, y_special, y_others)
    632 self._n_prebins = len(n_records)
    634 self._categories = categories

ValueError: not enough values to unpack (expected 8, got 3)

Originally, I was using a BinningProcess + Scorecard pipeline, but going in the details of the issue I've found it originates in the ContinuosBinning class, so I've posted as a problem with it.
By changing the prebinning_method = "uniform" in ContinuosBinning the issue vanishes, but how do I pass this argument in the BinningProcess?

@guillermo-navas-palencia
Copy link
Owner

Hi @CarloNicolini.

I am unable to reproduce this error. I understand you are using Linux and Python 3.10, an environment tested with GitHub actions. You can pass specific parameters using binning_fit_params. For example

binning_fit_params = {v: {'prebinning_method': 'uniform'} for v in variables}

http://gnpalencia.org/optbinning/tutorials/tutorial_binning_process_FICO_xAI.html#Modeling

@CarloNicolini
Copy link
Author

binning_fit_params = {v: {'prebinning_method': 'uniform'} for v in variables}

With this step, the error goes away for my categorical variables. However I am able to reproduce it when switching back to "prebinning_method": "cart".
This happens on Mac M1 and optbinning==0.16.1

@guillermo-navas-palencia
Copy link
Owner

Thanks. Could you please send a reproducible example? I am not a macOs user, but I could try that example via GitHub actions.

@guillermo-navas-palencia
Copy link
Owner

Hi @CarloNicolini.

The ContinuousOptimalBinning class had a bug when no prebinning splits were generated. The new release 0.17.0 will fix it. In the meantime, you can use this branch: https://github.com/guillermo-navas-palencia/optbinning/tree/feature/continuous_binning_sample_weight.

To confirm, you should see a similar message when setting verbose=True:
image

@CarloNicolini
Copy link
Author

Thanks. Could you please send a reproducible example? I am not a macOs user, but I could try that example via GitHub actions.

Many thanks, I've just updated to 0.17.0 and it works without the "uniform" prebinning specification.

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
ToDo
  
Awaiting triage
Development

No branches or pull requests

2 participants