Applying the plot() function to an fft object will visualize the tree.
Let’s create an fft object called titanic.fft from the titanic dataset.
titanic.fft <- fft(
formula = survived ~.,
data = titanic
)To plot the tree, use plot():
plot(titanic.fft)You can specify additional arguments to the plot() command that will change what is displayed
which.tree: Which tree do you want to plot? You can specify an integer such as which.tree = 2 will plot the tree #2 in the fft object, or which.tree = "best.train" which will use the best training tree.
data: Which data do you want to apply the tree to? You can specify data = "train" or data = "test" to use the training or testing datasets stored in the fft object. Alternatively, you can specify a new dataset (e.g.; data = test.data
For example, let’s plot tree # 4 with which.tree = 4.
plot(titanic.fft,
which.tree = 4)Now let’s apply this tree to a new dataset. I’ll apply the tree to only data from children:
plot(titanic.fft,
which.tree = 2,
data = subset(titanic, age == "child")
)