I am trying to run Linear Regression
with LASSO
using Python's Scikit-learn
package.
For Lasso, my configurations are as follows:
lasso_eps = 0.0001
lasso_alpha = 20
lasso_iter = 5000
And the code for the model is as follows:
lasso_cv = LassoCV(eps=lasso_eps, n_alphas=lasso_alpha, max_iter=lasso_iter, normalize=True, cv=5)
model = make_pipeline(PolynomialFeatures(degree=2, interaction_only=False), lasso_cv)
model.fit(X_train, y_train.values.ravel())
y_predict = model.predict(X_test)
model_score = model.score(X_test, y_test)
print(f"Accuracy: {model_score}")
Though, I am getting my model score properly; I am getting the following warning as well:
/Users/pankajkumar/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/coordinate_descent.py:491: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Fitting data with very small alpha may cause precision problems.
ConvergenceWarning)
Could anyone suggest, what this warning means and how it can be resolved? Any help would be much appreciated.