Troubleshooting ConvergenceWarning?

Is the idea here that we are just supposed to disregard the ConvergenceWarning messages right now?

My instinct would be to check how many categories are being produced by the encoder (OrdinalEncoder or OneHotEncoder) to see if there are dimensionality issues (i.e. too many features for the number of instances). But because we are using cross validation, there is no fitted encoder to inspect. I could call .fit on the pipeline containing the encoder but that pattern has not been introduced.

If I understand correctly what you are talking about, the warning message points to a convergence problem of the LogisticRegression provided the default number of iterations. Try increasing this parameter e.g. max_iter=1_000.

I just want to emphasize some additional things:

  • You get a warning and not an error. The estimator is not optimal but your code ran.
  • If you look at the Solution notebook located below the jupyter notebook and above the page’s forum (you will have to click on Solution > Look at the solution: to display it) you may usually get some additional information, but try to make the exercises without looking at it!