AttributeError: ‘LassoLarsCV‘ object has no attribute ‘mse_path_‘问题求解

AttributeError: ‘LassoLarsCV’ object has no attribute 'mse_path_'问题求解

wineModel = LassoLarsCV(cv=10).fit(X, Y)

Display results

t1 = time.time()
t_lasso_lars_cv = time.time() - t1

plt.figure()

plt.plot(wineModel.alphas_, wineModel.mse_path_, ‘:’)

plt.plot(wineModel.alphas_, wineModel.mse_path_.mean(axis=-1),
label=‘Average MSE Across Folds’, linewidth=2)

plt.axvline(wineModel.alpha_, linestyle=’–’,
label=‘CV Estimate of Best alpha’)
plt.semilogx()
plt.legend()
ax = plt.gca()
ax.invert_xaxis()
plt.xlabel(‘alpha’)
plt.ylabel(‘Mean Square Error’)
plt.axis(‘tight’)
plt.show()

代码提示AttributeError: ‘LassoLarsCV’ object has no attribute 'mse_path_'错误,不知怎么解决。此代码使用LassoLars(cv=10).fit(X, Y)方法就没有问题,使用 ‘LassoLarsCV’ 方法就不行。并且官方说明中 ‘LassoLarsCV’ 是有’mse_path_'这个参数的。求问。AttributeError: ‘LassoLarsCV‘ object has no attribute ‘mse_path_‘问题求解_第1张图片

你可能感兴趣的:(Lasso,LassoLars,LassoLarsCV,python,机器学习)