scikit-learn LassoCV、LassoLarsCV、ElasticNetCV 中的评分参数

数据挖掘 回归 scikit-学习
2022-03-13 23:56:41

我正在查看线性正则化方法中的参数,并在 scikit-learn 中进行交叉验证。RidgeCV 有一个参数评分,默认为无,但可以使用自定义评分器(例如 RMSE)。我注意到其他类(LassoCV、LassoLarsCV、ElasticNetCV)没有提供这样的选项。为什么是这样?所有这些都默认使用MSE吗?

1个回答

RidgeCV实现 CV by GridSearchCV,支持自定义记分器。

但是,LassoCV并通过MSE 作为硬编码评分ElasticNetCV来实现 CV 。通过 实现 CV ,MSE 也作为硬编码评分。LinearModelCVLassoLarsCVLarsCV

如果你想使用其他得分手,也许你可以GridSearchCV直接使用。

参考

https://github.com/scikit-learn/scikit-learn/blob/14031f6/sklearn/linear_model/ridge.py#L1092

https://github.com/scikit-learn/scikit-learn/blob/14031f6/sklearn/linear_model/coordinate_descent.py#L1181

https://github.com/scikit-learn/scikit-learn/blob/14031f6/sklearn/linear_model/least_angle.py#L1143