plot - RandomForest Fuzzy Decision Boundary With R -


i'm having troubles plotting "fuzzy" decision boundary randomforest model r. i'm sorry in advance if english isn't enough explain correctly problem.

i'll explain better mean fuzzy decision boundary, mean want filling of decision boundary shade confidence of prediction lower.

i trained randomforest iris data, generated sequence of data , predicted result model fill everywhere plot , without "fuzzy part" it's ok.

that's did.

library(randomforest) library(ggplot2) iris2 <- droplevels(subset(iris,species == "versicolor" | species == "virginica")) attach(iris2) newdata=data.frame(expand.grid(sepal.length=seq(4.7,8,0.01), petal.length=seq(2.6,7,0.01))) iris_rf <- randomforest(species~petal.length+sepal.length,data=iris2) newrf <- predict(iris_rf,newdata) ggplot(newdata,aes(x=petal.length,y=sepal.length,fill=newrf)) + geom_raster() + scale_fill_manual(values = c("blue", "red")) 

now want filling shade based on receive using data

newrf2 <- predict(iris_rf,newdata,type="prob") 

i know alpha parameter regulates shading, takes numerical value. how can it?

thanks in advance


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -