Re: Fwd: Re: Party extract BinaryTree from cforest?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Re: Party extract BinaryTree from cforest?

Torsten Hothorn-4

> ---------- Forwarded message ----------
> Date: Wed, 5 Oct 2011 21:09:41 +0000
> From: Chris <[hidden email]>
> To: [hidden email]
> Subject: Re: [R] Party extract BinaryTree from cforest?
>
> I found an internal workaround to this to support printing and plot type
> simple,
>
> tt<-party:::prettytree(cf at ensemble[[1]], names(cf at data at
> get("input")))
>> npt <- new("BinaryTree")
>> npt@tree<-tt
>> plot(npt)
> Error in terminal_panel(<S4 object of class "BinaryTree">) :
>  âctreeobjâ is not a regression tree
library("party")
cf <- cforest(Species ~ ., data = iris)
pt <- party:::prettytree(cf@ensemble[[1]], names(cf@data@get("input")))
pt
nt <- new("BinaryTree")
nt@tree <- pt
nt@data <- cf@data
nt@responses <- cf@responses
nt
plot(nt)

will do.

Torsten

>> plot(npt, type="simple")
>
> Any additional help is appreciated.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.