GetCtree: Gets a tree from a conditional random forest

View source: R/GetCtree.R

GetCtreeR Documentation

Gets a tree from a conditional random forest

Description

This function gets the ith tree from a conditional random forest as produced by cforest.

Usage

GetCtree(object, k = 1)

Arguments

object

An object as returned by cforest (or fastcforest).

k

The index of the tree to get from the forest. Default is 1.

Value

A tree of class BinaryTree, as returned by ctree from party package.

Note

Code taken from https://stackoverflow.com/questions/19924402/cforest-prints-empty-tree

Examples

  data(iris)
  iris2 = iris
  iris2$Species = factor(iris$Species == "versicolor")
  iris.cf = party::cforest(Species ~ ., data = iris2,
            control = party::cforest_unbiased(mtry = 2, ntree = 50))
  plot(GetCtree(iris.cf))

moreparty documentation built on Nov. 22, 2023, 5:08 p.m.