简体   繁体   English

决策树二元变量节点解释

[英]Decision Tree binary variable node interpretation

I've built a decision tree in python using sklearn library and I've got a question how to interpret split in a node for binary variable.我已经使用 sklearn 库在 python 中构建了一个决策树,并且我有一个问题如何解释二进制变量的节点中的拆分。 See a screenshot here在此处查看屏幕截图

So I have a variable if_successful which is binary, where 1 indicates successful transaction and 0 not-successful.所以我有一个二进制变量if_successful ,其中 1 表示交易成功,0 表示不成功。 The header of that leaf says if_successful <= 0,002 .那片叶子的 header 说if_successful <= 0,002 How do I interpret this?我如何解释这个? I thought that to the left we have True and False to the right, so if_successful = 1 on left arrow and if_successful = 0 on the right.我认为左边我们有TrueFalse到右边,所以if_successful = 1在左箭头和if_successful = 0在右边。 However here if if_successful <= 0,002 is True then it is basically if_successful = 0 ?但是在这里如果if_successful <= 0,002是 True 那么它基本上是if_successful = 0 Then interpretation is the opposite and I'm quite confused about that.然后解释是相反的,我对此感到很困惑。 How do I interpret split that header for binary variables?如何解释二进制变量的 header 拆分?

Your decision tree is treating the binary variable as a numeric variable, hence the representation if_successful <= 0.002 .您的决策树将二进制变量视为数字变量,因此表示if_successful <= 0.002 Cast the variable to binary or boolean and train the model and it will work fine and give you a 0 or 1 split.将变量转换为二进制或 boolean 并训练 model 它将正常工作并为您提供01拆分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM