gpt4 book ai didi

python - clf.score(X_test,Y_test) 如何用于线性回归?

转载 作者:行者123 更新时间:2023-11-30 08:53:59 25 4
gpt4 key购买 nike

Y_预测=

[ 1.22770607 -0.04569864  2.23941551  1.35143415  1.28991445  0.01398049
1.05511961 1.84491163 1.36748873 1.06369944 1.7139329 -0.09376361
-0.16512009 -0.0847085 -0.03141076 1.40425663 2.01371189 1.03977449
1.27667011 1.98481437 0.01295936 1.60489574 0.0823478 1.92856356
1.8584911 1.8970799 1.79401204 2.05206755 0.018738 0.00754765
-0.14906387 -0.0721375 1.18370287 -0.00857916 -0.03033274 1.69166794
1.29215806 -0.08232208 -0.09134106 -0.1708265 1.76007136 1.38080694
1.31560775 -0.06333357 -0.11464793 0.94925056 1.47575594 1.71846632
1.19986579 2.15035351 1.19564044 2.04054474 1.38920784 -0.09675278
2.00947585 1.00163388 -0.1021645 -0.05493268 0.12571214 0.97425353]

Y_测试=

[2 0 0 0 1 0 1 2 0 1 2 0 2 2 1 1 2 1 0 1 2 0 0 1 1 0 2 0 0 1 1 2 1 2 2 1 0
0 2 2 0 0 0 1 2 0 2 2 0 1 1 2 1 2 0 2 1 2 1 1 1 0 1 1 0 1 2 2 0 1 2 2 0 2
0 1 2 2 1 2 1 1 2 2 0 1 2 0 1 2]

但是分数是94.2%

分类器如何计算这个分数?

最佳答案

来自documentation

Returns the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1 - u/v), where u is the regression sum of squares
((y_true - y_pred) ** 2).sum() and v is the residual sum of squares
((y_true - y_true.mean()) ** 2).sum().

关于python - clf.score(X_test,Y_test) 如何用于线性回归?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45339749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com