This is the code that I have tried to execute:
from sklearn.model_selection import RandomizedSearchCV
from scipy.stats import loguniform
# Write your code here.
param_distributions={
'logisticregression__C':loguniform(1e-3,10),
'columntransformer__num_preprocessor__with_mean': [True, False],
'columntransformer__num_preprocessor__with_std': [True, False],
}
model_random_search = RandomizedSearchCV(
model, param_distributions=param_distributions, n_iter=20, n_jobs=2, random_state=42,
verbose=1, error_score=np.nan)
model_random_search.fit(data_train, target_train)
While trying to fit the random_search I’m getting the error message as follows:
/opt/conda/lib/python3.9/site-packages/sklearn/linear_model/_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Increase the number of iterations (max_iter) or scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
Please suggest to how to correct this, or help me know where I have gone wrong.