类似于这种图,怎么在lasso回归之后画出这种图,下面是代码
```python
import pandas as pd
import numpy as np
from sklearn import model_selection
from sklearn.linear_model import Lasso, LassoCV
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
data = pd.read_csv(r'')
#拆分为训练集和测试集
predictors = data.columns[1:]
x_train, x_test, y_train, y_test = model_selection.train_test_split(data[predictors], data.fuel,
test_size=0.25, random_state=1234)
#构造不同的lambda值
Lambdas = np.logspace(-7, -1, 200)
#设置交叉验证的参数,使用均方误差评估
lasso_cv = LassoCV(alphas=Lambdas, normalize=True, cv=10, max_iter=10000)
lasso_cv.fit(x_train, y_train)
#基于最佳lambda值建模
lasso = Lasso(alpha=lasso_cv.alpha_, normalize=True, max_iter=10000)
lasso.fit(x_train, y_train)
#打印回归系数
print('最优参数:', lasso_cv.alpha_)
print(pd.Series(index=['Intercept']+x_train.columns.tolist(),
data=[lasso.intercept_]+lasso.coef_.tolist()))
#模型评估
lasso_pred = lasso.predict(x_test)
#均方误差
MSE = mean_squared_error(y_test, lasso_pred)
print('均方误差:', MSE)
train_score = lasso.score(x_train, y_train) # 模型对训练样本得准确性
test_score = lasso.score(x_test, y_test) # 模型对测试集的准确性
print(train_score)
print(test_score)