Skip to content
Advertisement

“Not enough values to unpack” in sklearn.fit

Here’s the piece of the code:

JavaScript

This says:

JavaScript

The train and test datasets had been prepared before, and they behave nicely with other classifiers.

Such a generic error message tells me nothing. What is the problem here?

Advertisement

Answer

In short, the issue was that you passed the result of skf.split(titanic_dataset, surv_titanic) to the cv argument on LogisticRegressionCV when you needed to pass StratifiedKFold(n_splits=5) directly instead.

Below I show the code that reproduced your error, and below that I show two alternative methods that accomplish what I believe you were trying to do.

JavaScript
Advertisement