Ill-conditioned matrix warning

While going through the regularization lecture, I encountered this error repeated several times:

from sklearn.linear_model import Ridge

ridge = make_pipeline(PolynomialFeatures(degree=2),
                      Ridge(alpha=100))

cv_results = cross_validate(ridge, 
                            data, target,
                            cv=10, 
                            scoring="neg_mean_squared_error",
                            return_train_score=True,
                            return_estimator=True)
/opt/conda/lib/python3.9/site-packages/sklearn/linear_model/_ridge.py:147: LinAlgWarning: Ill-conditioned matrix (rcond=2.672e-17): result may not be accurate.
  return linalg.solve(A, Xy, sym_pos=True,
/opt/conda/lib/python3.9/site-packages/sklearn/linear_model/_ridge.py:147: LinAlgWarning: Ill-conditioned matrix (rcond=2.67257e-17): result may not be accurate.
...
...
...

What is the issue here?

Indeed, you should continue the notebook and get some intuitions. In short, it is due to not scaling the data that make the matrix X after feature expansion ill-conditioned. You will see that scaling the data within the pipeline will solve that issue.