Description Usage Arguments See Also Examples
Plot Naive Bayes Models
| 1 2 3 | 
| x | 
 | 
| xlim, ylim | 
 | 
| features | 
 | 
| sdevs | 
 | 
| gridsize | 
 | 
| data | 
 | 
| class.name | 
 | 
| ... | Currently ignored. | 
| gg | 
 | 
| psize | 
 | 
nb2, update.nb2,
print.nb2, predict.nb2
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | mod <- nb2(iris[, 1:4], iris[, 5])
plot(mod, features = 2:3, xlim = c(1.5, 4.5), ylim = c(0.5, 7.5),
     gridsize = 75, gg = FALSE)
points(iris[, 2:3], col = iris[, 5], pch = 4, lwd = 3)
require(ggplot2)
mod1 <- nb2(iris[, 1:4], iris[, 5])
preds <- predict(mod1, iris[, c(1, 3)])
iris2 <- cbind(iris, err = (preds != iris$Species))
plot(mod1, features = c(1, 3), xlim = c(4, 8), ylim = c(0, 8)) +
  geom_point(data = subset(iris2, iris2$err),
             aes(x = Sepal.Length, y = Petal.Length, shape = Species),
             size = 3.5, col = "white", show.legend = FALSE) +
  geom_point(aes(x = Sepal.Length, y = Petal.Length, shape = Species),
             data = iris2, size = 2) +
  guides(colour = FALSE, shape = FALSE)
discParam <- list(Sepal.L = c(5, 6, 7), Sepal.W = c(2.5, 3.5))
mod2 <- nb2(iris[, 1:4], iris[, 5], discretize = "fixed",
            discParams = discParam)
preds <- predict(mod2, iris[, c(1, 3)])
iris2 <- cbind(iris, err = (preds != iris$Species))
plot(mod2, features = c(1, 3), xlim = c(4, 8), ylim = c(0, 8)) +
  geom_point(aes(x = Sepal.Length, y = Petal.Length, shape = Species),
             data = subset(iris2, iris2$err), size = 3.5, col = "white",
             show.legend = FALSE) +
  geom_point(aes(x = Sepal.Length, y = Petal.Length, shape = Species),
  data = iris2, size = 2) +
  guides(colour = FALSE, shape = FALSE)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.