【发布时间】:2019-08-06 01:57:26
【问题描述】:
我有这个数据框
test_y
Out[55]:
Results
47302 0
65704 0
63472 1
47247 1
5674 0
5405 1
65501 0
14418 1
18521 1
7631 1
1221 0
23915 1
10548 0
18698 1
46644 0
56585 1
50018 0
54615 1
22613 1
当我运行预测时,我得到一个无法与数据帧进行比较的数组
test_y_predictions = model.predict(test_X)
test_y_predictions
Out[57]:
array([[0.49395287],
[0.26348412],
[0.6578461 ],
...,
[0.74228203],
[0.4677609 ],
[0.6267687 ]], dtype=float32)
我想知道我得到了多少正确的结果
我试过了,但出错了
test_y_predictions = round(test_y_predictions)
TypeError: type numpy.ndarray 没有定义 round 方法
我如何比较我从预测中得到的和我拥有的?
【问题讨论】:
-
为了澄清,您正在尝试将值四舍五入为最接近的整数以获得 0/1 标签,对吗?
标签: python dataframe prediction