Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Confirm or disconfirm the idea that pocket accuracy increases with NN by extending the plot to have a domain from 0 to 1500. def get_data_nonlin(N,line_coef=(-1,0.9,1),seed=42):

Confirm or disconfirm the idea that pocket accuracy increases with NN by extending the plot to have a domain from 0 to 1500.

def get_data_nonlin(N,line_coef=(-1,0.9,1),seed=42): np.random.seed(seed) # So that everyone has the same "random" points points = np.zeros(3*N).reshape(N,3) points[:,1] = np.random.rand(N) #random x-coordinates points[:,2] = np.random.rand(N) #random y-coordinates points[:,0] = np.ones(N) #bias column

line_coef = (-1,0.9,1) #this line will define whether a point is a positive or negative example pos = points.dot(line_coef) >= 0 # positive examples are above the line for i in range(N//10): # Now we flip about 10% of the data (could be less b/c collisions) r = np.random.randint(len(pos)) pos[r] = ~pos[r] return points,pos

_N = np.arange(35,1001,1) _L = np.zeros(1001-35) for i,n in enumerate(_N): X,pos = get_data_nonlin(n) y = 2*pos -1 w=Pocket_Algorithm(X,y) _L[i] = E_in(X,w,y)

plt.scatter(_N,_L,alpha=0.2) plt.xlabel("Data size") plt.ylabel(r"Pocket $E_{in}$") plt.title("Pocket algorithm performance (2000 iterations)") plt.show()

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_2

Step: 3

blur-text-image_3

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

1. What are the pros and cons of diversity for an organisation?

Answered: 1 week ago

Question

1. Explain the concept of diversity and equality in the workplace.

Answered: 1 week ago