Skip to content

Commit

Permalink
sup-classif:nb fix dec bound plot
Browse files Browse the repository at this point in the history
  • Loading branch information
berndbischl committed Nov 8, 2024
1 parent b3b3404 commit 467fcd1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion slides/supervised-classification/rsrc/fig-disc_cod.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@ plot <- ggplot(plot_data, aes(x = dimension, y = classif.ce, color = learner_id,
legend.title = element_text(face = "bold", size = 20),
legend.text = element_text(face = "bold", size = 16)
)
print(plot)
ggsave("../figure/disc_cod.png", plot = plot, width = plot_width, height = plot_height, dpi = plot_dpi)
10 changes: 5 additions & 5 deletions slides/supervised-classification/rsrc/fig-nb-db.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ library(mvtnorm)

# common settings
set.seed(1234)
plot_width <- 20
plot_height <- 10
plot_dpi <- 300
line_size <- 5
base_size <- 40
Expand All @@ -29,16 +27,17 @@ n = 300

classa = data.frame(mvrnorm(n = n,
mu = c(2, 2),
Sigma = matrix(c(2, 0, 0, 2),
Sigma = matrix(c(1, 0.1, 0.1, 1),
ncol = 2,
byrow = TRUE)))

classb = data.frame(mvrnorm(n = n,
mu = c(10, 7),
Sigma = matrix(c(8, -6, -6, 8),
Sigma = matrix(c(5, -2, -2, 1),
ncol = 2,
byrow = TRUE)))


df = cbind(classa, factor(rep("a", ncol(classa))))
colnames(df) = c("x1", "x2", "y")

Expand Down Expand Up @@ -92,6 +91,7 @@ pl = ggplot() +
scale_fill_manual(values = c("a" = "#E69F00", "b" = "#56B4E9")) +
scale_color_manual(values = c("a" = "#E69F00", "b" = "#56B4E9")) +
labs(x = expression(x[1]), y = expression(x[2]), color = "class", fill = "class") +
coord_fixed(ratio = 1) +
theme_minimal() +
scale_alpha(range = c(0.1, 0.5), guide = 'none') +
theme(
Expand All @@ -103,4 +103,4 @@ pl = ggplot() +
)

# Save directly to PNG
ggsave(filename = "../figure/nb-db.png", plot = pl, width = plot_width, height = plot_height, dpi = plot_dpi)
ggsave(filename = "../figure/nb-db.png", plot = pl, dpi = plot_dpi)

0 comments on commit 467fcd1

Please sign in to comment.