我使用linear_model.LinearRegressionscikit-learn作为预测模型.它的工作原理很完美.我有一个问题是使用accuracy_score指标评估预测结果.这是我的真实数据:
array([1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0])
Run Code Online (Sandbox Code Playgroud)
我的预测数据:
array([ 0.07094605, 0.1994941 , 0.19270157, 0.13379635, 0.04654469,
0.09212494, 0.19952108, 0.12884365, 0.15685076, -0.01274453,
0.32167554, 0.32167554, -0.10023553, 0.09819648, -0.06755516,
0.25390082, 0.17248324])
Run Code Online (Sandbox Code Playgroud)
我的代码:
accuracy_score(y_true, y_pred, normalize=False)
Run Code Online (Sandbox Code Playgroud)
错误信息:
ValueError:无法处理二进制和连续目标的混合
救命 ?谢谢.
python machine-learning prediction linear-regression scikit-learn