Python clf分数(X_检验,Y_检验)如何适用于线性回归?

Python clf分数(X_检验,Y_检验)如何适用于线性回归?,python,machine-learning,scikit-learn,linear-regression,Python,Machine Learning,Scikit Learn,Linear Regression,你预测= [ 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

你预测=

[ 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%

分类器如何计算该分数?

来自


准确度仅适用于分类问题。您使用的是线性回归,这是一种回归模型。它不适合分类(从真正的标签判断,您的问题是)<代码>线性回归().score()将计算预测的R平方值。你清楚你在做什么以及为什么吗?
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().