Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 采用精准度,实现简单贴合和交叉验证_Python_Scikit Learn - Fatal编程技术网

Python 采用精准度,实现简单贴合和交叉验证

Python 采用精准度,实现简单贴合和交叉验证,python,scikit-learn,Python,Scikit Learn,我有这样一个简单的模型: lm = linear_model.LinearRegression() model = lm.fit(X_train, y_train) predictions = lm.predict(X_test) print accuracy_score(y_test, predictions) 通过使用交叉验证,我有以下几点: from sklearn.model_selection import cross_val_score accuracies = cross_val

我有这样一个简单的模型:

lm = linear_model.LinearRegression()
model = lm.fit(X_train, y_train)
predictions = lm.predict(X_test)
print accuracy_score(y_test, predictions)
通过使用交叉验证,我有以下几点:

from sklearn.model_selection import cross_val_score
accuracies = cross_val_score(estimator = model, X = X_train, y = y_train, cv = 7)

从交叉验证中,我如何获得准确度以获得相同的测量打印
准确度\u分数(y\u测试,预测)
?是否为
精度。mean()

打印精度将在交叉验证的每一次折叠中提供一系列精度

print“Train set score::{}”。format(accuracies.mean())
将给出交叉验证和验证的平均精度


print“Train set score::{}+/-{}”。format(accuracies.mean(),accuracies.std()*2)
将为您提供准确度以及平均偏差

您想要每个交叉验证集的准确度还是平均值?@PratikKumar如果可能的话,我想要两者