I think during my research to solve this question I came pretty close. I am looking for something like this for the C5.0 package.
The method provided in the SO answer works with a party
object. However the C5.0 package does not support as.party
. On my further research I found this comment that the maintainer of the C5.0 package already programmed the function, but did not export it.
I thought great this should work, but unfortunately the suggested function C50:::as.party.C5.0(mod1)
throws the error:
error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class ""function"" to a data.frame
Any suggestions to solve this error appreciated. Let's use the following example:
library(C50)
p = iris[1:4]
t = factor(iris$Species)
model = C50::C5.0(p,t)
#summary(model)
modParty = C50:::as.party.C5.0(model)