Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE USE PYTHON Below we use the pocket algorithm to find a linear separator w for the breast cancer data and then output its E_in

PLEASE USE PYTHON

image text in transcribed

Below we use the pocket algorithm to find a linear separator w for the breast cancer data and then output its E_in What is the accuracy? That is, what percentage of the datapoints does the classifier W classify correctly? Change the code below so that the accuracy is printed as well as E_in Xnp.ones (D.shape[ 01*3).reshape (D.shape I 0,3) y- 2*malignant -1 # so that y in {-1,1), not {0,1} w - Pocket_Algorithm (X,y,2000) wp-w/w[-1] # dividing out c as described in comments to first code cell E-in ( x,w,y) 0.1054481546572935 In the plot below we visualize the learned decision boundary. import numpy as np import matplotlib.pyplot as plt plt.scatter (xm, ym, label-"malignant", alpha-0.3) plt.scatter (xb,yb, label-"benign" ,alpha-0.3) plt.plot ( x , yh, 'brown. 1abel.'' learned plt.axis (-0.05,0.5,0,.081) plt.legend() plt.show () boundary") #plot linear separator Below we use the pocket algorithm to find a linear separator w for the breast cancer data and then output its E_in What is the accuracy? That is, what percentage of the datapoints does the classifier W classify correctly? Change the code below so that the accuracy is printed as well as E_in Xnp.ones (D.shape[ 01*3).reshape (D.shape I 0,3) y- 2*malignant -1 # so that y in {-1,1), not {0,1} w - Pocket_Algorithm (X,y,2000) wp-w/w[-1] # dividing out c as described in comments to first code cell E-in ( x,w,y) 0.1054481546572935 In the plot below we visualize the learned decision boundary. import numpy as np import matplotlib.pyplot as plt plt.scatter (xm, ym, label-"malignant", alpha-0.3) plt.scatter (xb,yb, label-"benign" ,alpha-0.3) plt.plot ( x , yh, 'brown. 1abel.'' learned plt.axis (-0.05,0.5,0,.081) plt.legend() plt.show () boundary") #plot linear separator

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

7. Define cultural space.

Answered: 1 week ago

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago