Reputation: 10629
I have
## Classification:
library("randomForest")
data=iris
data<-data[data$Species!="setosa",]
data$Species<-factor(as.character(data$Species))
iris.rf <- randomForest(Species ~ Sepal.Length+Petal.Length, data=data, importance=TRUE, proximity=TRUE)
I would like to construct a Sepal.Length~Petal.Length
with the decision boundary. And what kind of boundary will this be? 0.5 probability for each of the 2 classes?
Upvotes: 1
Views: 2624
Reputation: 19005
You have a random forest, so there is not necessarily a clear decision boundary like you would get from a non-probabilistic linear classifier like SVM. But you could plot it with something like...
library(ggplot2)
ggplot(data=data,aes(x=Petal.Length, y=Sepal.Length, color= iris.rf$predicted) ) +
geom_point()
And in this case yes, since you trained it only on two classes, the boundary represented by the color change happens at 0.5.
Upvotes: 1