CS 4375 Homework 5 April 12, 2022 Deadline for the first submission: Apr XXXXXXXXXX. All assignments MUST have your name, student ID, course name/number at the beginning of your documents. Your...

Please give me the ipynb file and pdf file as mentioned in the homework pdf, the questions ask us to change the code given in the example code html file so please use that for reference.


CS 4375 Homework 5 April 12, 2022 Deadline for the first submission: Apr-13-2022. All assignments MUST have your name, student ID, course name/number at the beginning of your documents. Your homework MUST be submitted via eLearning with file format and name convention as follows: HW# Name writeup.pdf (for writing part) HW# Name code.ipynb (for coding part) If you have any questions, please contact me. Q1 Given a dataset of two positive points (red points): [6, 2]T , [6, 4]T , and two negative points (green points): [2, 4]T , [3, 6]T , as shown in figure below, the problem of a linearly separable SVM can be formulated as the following form: minx 1 2 xTQx+ pTx subject to Gx ≤ h (1) Write down the values of Q, p, G, and h. Q2 Modify the provided example code “example-code.py” to solve the linearly separable SVM problem in Q1 and output the following values: 1. The values of w and b that decide the separating line w.x+ b = 0. 2. The margin size. 3. The support vectors. 4. Predict the class labels of the points: [3, 5]T , [3, 4]T , [4, 6]T , [5, 4]T , [5, 2]T , [5, 6]T . 1 Q3 Given a dataset of three positive points (red points): [3, 5]T , [5, 3]T , [6, 6]T , and two negative points (green points): [5, 6]T , [6, 5]T , as shown in figure below, the problem of a linearly non-separable SVM can be formulated as the following form: minx 1 2 xTQx+ pTx subject to Gx ≤ h (2) Write down the values of Q, p, G, and h. Q4 Set the trade-off parameter C = 1. Modify the provided example code “example-code.py” to solve the linearly non-separable SVM problem in Q3 and output the following values: 1. The values of w and b that decide the separating line w.x+ b = 0. 2. The margin size. 3. The support vectors. 4. Predict the class labels of the points: [3, 4]T , [3, 6]T , [4, 3]T , [4, 5]T , [5, 4]T , [5, 2]T , [5, 6]T , [6, 4]T , [6, 7]T , [7, 5]T , [7, 6]T . Q5 Set the trade-off parameter C = 1000. Use the same dataset in Q3 and the basis functions ϕ(x) = [x1, x2, x 2 1, x 2 2, x1 · x2]T , where x = [x1, x2]T . Further modify the code implemented for Q4 to train a nonlinear SVM model and output the following values: 1. The values of w and b that decide the separating line w.ϕ(x) + b = 0. 2. The margin size. 3. The support vectors. 4. Predict the class labels of the points: [3, 4]T , [3, 6]T , [4, 3]T , [4, 5]T , [5, 4]T , [5, 2]T , [5, 6]T , [6, 4]T , [6, 7]T , [7, 5]T , [7, 6]T . 2
Apr 13, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here