Question: Can you please help me with Task 3, my output is not matching the expected output. You need to called the parameters. solution = import


Can you please help me with Task 3, my output is not matching the expected output. You need to called the parameters. solution =
import quadprog import numpy as np # The helper function. Dot not change it def quadprog_solve_qp(P, q, G=None, h=None, A=None, b=None) : qp_G = .5 * (P + P.T) # make sure P is symmetric qp_a = -9 if A is not None: qp_C -np.vstack([A, G]).I -np. hstack([b, h]). A. shape [0] else: # no equality constraint qp_C = -G.T qp_b = -h. meq = 0 return quadprog.solve_qp(qp_G, qp_a, qp_C, qp_b, meq)[0] qp_b meg # Toy data X = np.array ( [ [0, 0], [2, 0], [0, 2], [3, 3], [4, 4] ]). Y = np.array([-1, -1, -1, 1, 1]) Task We want to build an SVM model on the toy dataset: (3) (4) x(!) = (0,0), y(") = -1 x(2) = (2,0), (2) = -1 = (0,2), y) = -1 = (3,3), (4) = 1 x(5) = (4,4), y) = 1 We need to solve the quadratic programming (QP) problem as the following form: min la" Qa - (1)a) subject to: y a = 0, a > 0 The quadprog package by defaualt solves the QP as this form: min (x? Px+q"x) subject to: Gx
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
