Last answered:

25 Jan 2022

Posted on:

25 Jan 2022

1

Resolved: ConvergenceWarning: lbfgs failed to converge (status = 1)

Hi.  When running the reg_lgd_st_1.fit(lgd_inputs_stage_1_train, lgd_targets_stage_1_train) I get the following warning: /databricks/python/lib/python3.8/site-packages/sklearn/linear_model/_logistic.py:763: ConvergenceWarning: lbfgs failed to converge (status=1): STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

I'm using a different data set than the one given for these videos.  I've nonetheless followed all data preprocessing steps and have similar data.  My environment is in Databricks.  The output says to either increase the # of iterations (max_iter) or scale the data (which I've already done).  How would I adjust the max_iter within the LogisticRegression class shown in the video?  Thanks!

image.png
 

1 answers ( 1 marked as helpful)
Posted on:

25 Jan 2022

1

I figured it out.  To do that within the class, add the max_iter arguement as shown below.

self.model = linear_model.LogisticRegression(*args, **kwargs, max_iter=1000)

Submit an answer