ctree plot decision tree in party package in R , terminal node occurs some weird numbers - issue?

霸气de小男生 提交于 2019-12-12 19:17:46

问题


I came across something really odd.. and I couldn't figured it out why..

I use the same code here below :

library(party)
r_tree <- ctree(readingSkills$nativeSpeaker ~ readingSkills$age + 
                 readingSkills$shoeSize + readingSkills$shoeSize + 
                 readingSkills$score,data = readingSkills)
plot(r_tree,type = "simple")
r_tree

two week ago I got normal graph .. but today my terminal nodes have some odd numbers in them like showing in this picture below.. I have tried to restarted my PC , uninstalled the packet , reinstall again and again , but it still not working..

Just wondering if anyone see the same issue , or what have I done wrong , or how can I fix this ?

Thanks


回答1:


This is a bug caused by package "partykit". If you'll reopen R from start or do:

detach("package:partykit", unload=TRUE) and run

library(party)
r_tree <- ctree(readingSkills$nativeSpeaker ~ readingSkills$age + 
                  readingSkills$shoeSize + readingSkills$shoeSize + 
                  readingSkills$score,data = readingSkills)
plot(r_tree,type = "simple")

You'll get the normal plot

But if you'll library the "partykit" package again and rerun the same code, you''ll get that nonsense plot again

library(partykit)
r_tree <- ctree(readingSkills$nativeSpeaker ~ readingSkills$age + 
                  readingSkills$shoeSize + readingSkills$shoeSize + 
                  readingSkills$score,data = readingSkills)
plot(r_tree,type = "simple")



来源:https://stackoverflow.com/questions/14781349/ctree-plot-decision-tree-in-party-package-in-r-terminal-node-occurs-some-weird

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!