{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Assignment 11\n", "## Chapter 9" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Student ID: *Double click here to fill the Student ID*\n", "\n", "#### Name: *Double click here to fill the name*\n", "\n", "部分習題需要寫數學式。\n", "\n", "若不想用打的,可用手寫後,進行拍照或掃描,並使用以下指令引入圖片。\n", "\n", "請確認圖片清晰程度為可辨識。\n", "\n", "``" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2\n", "We have seen that in $p = 2$ dimensions, a linear decision boundary takes the form $β_0+β_1X_1+β_2X_2 = 0$.We now investigate a non-linear decision boundary." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "(a) Sketch the curve \n", "\n", "$$(1 + X_1)^2 + (2 − X_2)^2 = 4.$$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# coding your answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> Ans: *double click here to answer the question.*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "(b) On your sketch, indicate the set of points for which \n", "\n", "$$(1 + X_1)^2 + (2 − X_2)^2 > 4,$$\n", "\n", "as well as the set of points for which \n", "\n", "$$(1 + X_1)^2 + (2 − X_2)^2 ≤ 4$$." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# coding your answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> Ans: *double click here to answer the question.*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "(c) Suppose that a classifier assigns an observation to the blue class if\n", "\n", "$$(1 + X_1)^2 + (2 − X_2)^2 > 4,$$\n", "\n", "and to the red class otherwise. To what class is the observation $(0, 0)$ classified? $(−1, 1)$? $(2, 2)$? $(3, 8)$?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# coding your answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> Ans: *double click here to answer the question.*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Argue that while the decision boundary in (c) is not linear in terms of $X_1$ and $X_2$, it is linear in terms of $X_1, X^2_1, X_2,$ and $X^2_2$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> Ans: *double click here to answer the question.*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3\n", "Here we explore the maximal margin classifier on a toy data set." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "(a) We are given $n = 7$ observations in $p = 2$ dimensions. For each observation, there is an associated class label." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
Obs. | \n", "X1 | \n", "X2 | \n", "Y | \n", "
---|---|---|---|
1 | \n", "3 | \n", "4 | \n", "Red | \n", "
2 | \n", "2 | \n", "2 | \n", "Red | \n", "
3 | \n", "4 | \n", "4 | \n", "Red | \n", "
4 | \n", "1 | \n", "4 | \n", "Red | \n", "
5 | \n", "2 | \n", "1 | \n", "Blue | \n", "
6 | \n", "4 | \n", "3 | \n", "Blue | \n", "
7 | \n", "4 | \n", "1 | \n", "Blue | \n", "