Randomforest分类器输出
在我的型号打印出输出后,看起来像这样的东西,
id val
234 0.99
235 0.3
236 0
237 0.92
我希望Val列是二进制的,因此阈值也是如此。
test[test["val"] < 0.5] = 0
test[test["val"] >= 0.5] = 1
阈值后,由于某种原因,我的输出看起来像这样,
id val
1 1
0 0
0 0
1 1
我该如何确保ID列不会更改?
After my model prints out the output, it looks something like this
id val
234 0.99
235 0.3
236 0
237 0.92
i wanted the val column to be binary, so did thresholding.
test[test["val"] < 0.5] = 0
test[test["val"] >= 0.5] = 1
after thresholding, for some reason my output looks like this
id val
1 1
0 0
0 0
1 1
how do i make sure the id column doesn't change?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您提供的条件仅给出应更改的行。使用
loc
,并提供应更改的列。输出:
The condition you're providing only gives the rows that should change. Use
loc
and provide the column that should change as well.Output: