Learn R Programming

moreparty (version 0.4)

GetCtree: 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)

Value

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

Arguments

object

An object as returned by cforest (or fastcforest).

k

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

Examples

Run this code
  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))

Run the code above in your browser using DataLab