python机器学习 二分类 混淆矩阵_机器学习:混淆矩阵中的错误获取

在运行随机森林回归模型时,我在运行混淆矩阵时出错。该模型能够预测y_pred,但我无法检查准确性,因为我无法运行精度矩阵。在

数据类型:type(y_test)

Out[124]: numpy.ndarray

type(y_pred)

Out[125]: numpy.ndarray

以下是我的混淆矩阵代码:

^{pr2}$

错误:confusion_matrix(y_test, y_pred)

Traceback (most recent call last):

File "", line 1, in

confusion_matrix(y_test, y_pred)

File "/Users/srikantswamy/anaconda3/lib/python3.6/site-packages/sklearn /metrics/classification.py", line 253, in confusion_matrix

y_type, y_true, y_pred = _check_targets(y_true, y_pred)

File "/Users/srikantswamy/anaconda3/lib/python3.6/site-packages/sklearn /metrics/classification.py", line 88, in _check_targets

raise ValueError("{0} is not supported".format(y_type))

ValueError: continuous is not supported


版权声明:本文为weixin_42356162原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。