Skip to content
Snippets Groups Projects
Commit e8f82697 authored by Felix Ramnelöv's avatar Felix Ramnelöv
Browse files

Lab 2: Added plot for tree structure and recall-precision-curve

parent 5bdc3c6d
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,9 @@ optimal_tree <- prune.tree(fit2c, best = optimal_leaves)
summary(optimal_tree)
plot(optimal_tree)
text(optimal_tree, pretty=0)
# ----4.----
TP <- function(x, x_pred) {
......@@ -237,25 +240,25 @@ legend(
pch = c(16, 1)
)
# plot(
# logistic_recall,
# logistic_precision,
# type = "b",
# ylim = c(0, 1),
# xlim = c(0, 1),
# col = "red",
# main = "Precision depending on recall",
# xlab = "Recall",
# ylab = "Precision",
# pch = 16,
# )
# points(tree_recall,
# tree_precision,
# col = "blue",
# type = "b")
# legend(
# "bottomleft",
# legend = c("Logistic regression model", "Optimal tree"),
# fill = c("red", "blue"),
# pch = c(16, 1)
# )
\ No newline at end of file
plot(
logistic_recall,
logistic_precision,
type = "b",
ylim = c(0, 1),
xlim = c(0, 1),
col = "red",
main = "Precision depending on recall",
xlab = "Recall",
ylab = "Precision",
pch = 16,
)
points(tree_recall,
tree_precision,
col = "blue",
type = "b")
legend(
"bottomleft",
legend = c("Logistic regression model", "Optimal tree"),
fill = c("red", "blue"),
pch = c(16, 1)
)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment