From f1a2c5e004fcfe19d1d87b653cd2ba03bdb8bd12 Mon Sep 17 00:00:00 2001 From: "xuanyi.wang" Date: Mon, 22 May 2023 21:11:01 +0200 Subject: [PATCH] Update page 'Solutions to the questions concerning R language' --- ... to the questions concerning R language.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Solutions to the questions concerning R language.md b/Solutions to the questions concerning R language.md index fdffa29..abfbff3 100644 --- a/Solutions to the questions concerning R language.md +++ b/Solutions to the questions concerning R language.md @@ -444,4 +444,52 @@ The maximal margin classifier has to be in between observations #2, #3 and #5, # =>(2,1.5),(4,3.5) b=(3.5−1.5)/(4−2)=1 a=X2−X1=1.5−2=−0.5 +``` +``` +plot(x1, x2, col = colors, xlim = c(0, 5), ylim = c(0, 5)) +abline(-0.5, 1) +``` + + +**iii.** +``` +0.5−X1+X2>0 +``` + +**iv.** +``` +plot(x1, x2, col = colors, xlim = c(0, 5), ylim = c(0, 5)) +abline(-0.5, 1) +abline(-1, 1, lty = 2) +abline(0, 1, lty = 2) +``` + +**v.** +``` +plot(x1, x2, col = colors, xlim = c(0, 5), ylim = c(0, 5)) +abline(-0.5, 1) +arrows(2, 1, 2, 1.5) +arrows(2, 2, 2, 1.5) +arrows(4, 4, 4, 3.5) +arrows(4, 3, 4, 3.5) +``` + +**vi.** + +A slight movement of observation #7 (4,1) blue would not have an effect on the maximal margin hyperplane since its movement would be outside of the margin. + +**vii.** +``` +plot(x1, x2, col = colors, xlim = c(0, 5), ylim = c(0, 5)) +abline(-0.8, 1) +``` + +``` +−0.8−X1+X2>0 +``` + +**viii.** +``` +plot(x1, x2, col = colors, xlim = c(0, 5), ylim = c(0, 5)) +points(c(4), c(2), col = c("red")) ``` \ No newline at end of file