相关疑难解决方法(0)

scikit-learn RidgeCV 评分选项不起作用

我注意到cv_values_无论scoring选项如何,来自 RidgeCV 的值始终处于相同的指标中。下面是一个例子:

from sklearn.linear_model import RidgeCV
from sklearn.datasets import load_boston

boston = load_boston()

mod = RidgeCV(store_cv_values = True, scoring = 'r2')
fit = mod.fit(boston.data, boston.target)
print(fit)
print(fit.cv_values_)

mod = RidgeCV(store_cv_values = True, scoring = 'neg_mean_squared_error')
fit = mod.fit(boston.data, boston.target)
print(fit)
print(fit.cv_values_)
Run Code Online (Sandbox Code Playgroud)

输出是:

RidgeCV(alphas=(0.1, 1.0, 10.0), cv=None, fit_intercept=True, gcv_mode=None,
    normalize=False, scoring='r2', store_cv_values=True)
[[ 7.61705436  7.83092421  8.2298466 ]
 [ 2.50029583  2.31181064  2.11665248]
 [ 7.98280614  7.95286299  7.87166914]
 ..., 
 [ 5.24271689  5.50191347  5.84802692]
 [ 3.7448827   4.01778493  4.40457956]
 [ 0.0859419 …
Run Code Online (Sandbox Code Playgroud)

python scikit-learn

5
推荐指数
1
解决办法
1417
查看次数

标签 统计

python ×1

scikit-learn ×1