How to interpret the decision boundary output in R

r
decision_trees

#1

Hello,

While learning about decision trees I am trying to understand the concept of decision boundary.
My tree looks like:


Then I am trying to plot the decision boundary via:

xp <- seq(0, 1, length = 100)
yp <- seq(0, 1, length = 100)
data2dT <- expand.grid(x1 = xp, x2 = yp)
Z <- predict(tree.p, data2dT)
zp.cart <- Z[,1] - Z[,2]
contour(xp, yp, matrix(zp.cart, 100), add=F,
        levels=0, labcex=0.9, labels="",
        col = "green", lwd=2)

The output is:

How do I interpret this output??


#2

@data_hacks- as you have plotted the yp vs xp by this we can interpret that if the value which you have in the tree is in x axis and how much it classify with given value of x is shown in y axis which is specified at every node.

Hope this helps!
Regards,
hinduja1234