Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1. Use the perceptron algorithm to manually find a weight vector w= [w0,w1,w2] for linear classification of 3 data points (xiyi) satisfying sign(wxi)= yi.

image text in transcribed
image text in transcribed
Question 1. Use the perceptron algorithm to manually find a weight vector w= [w0,w1,w2] for linear classification of 3 data points (xiyi) satisfying sign(wxi)= yi. The input data are x1=(1,2,0)x2=(1,2,2)x3=(1,0,2)y1=+1y2=+1y3=1 The first element in vector xi is always x0=1 (See slides in lecture 1). In the first step of the perceptron algorithm, the initial assignment of w is [0,6,6]. The intermediate steps of the computation are needed. (25 points) Question 2. (a) Use Python to compute the weight vector w=[w0,w1,w2] for linear regression of N input data points (xiyi) that minimizes the sum of squared error (wxiyi)2 (use the method in slide 29 in lecture 2). The input data are x1=(1,3,2)x2=(1,2,2)x3=(1,1,1)x4=(1,1,3)y1=3y2=1y3=1y4=3 (b) Use the linearRegression module in Python package sklearn to find w for linear regression. Steps of the python code and intermediate results are needed (5 points). Question 3. In Fisher's linear discriminant analysis, we search for a vector w such that all data points are well separately after they are projected to the direction defined by w. The input data points are x1=(4,3)x2=(2,2)x3=(1,1)x4=(2,1)y1=1y2=1y3=1y4=1 (Note that the first element in vector xi is NOT x0=1 ). Use Python to find a vector w=[w1,W2] with Fisher's linear discriminant analysis. Steps of the python code and intermediate results are needed (use the steps in slide 43 in lecture 2) (25 points). Question 4. A heart disease data set (file heart_disease_data.txt in the folder) contains the medical information of 100 patients of two classes. The first row contains column names, and other rows contain the information of the patients. The last column "num" contains the classes of the patients. Use the perceptron module in Python package sklearn to find the weight vector w for linear classification (15 points). Use the LDA module in Python package sklearn to find the weight vector w for linear discriminant analysis. The python code of the analysis should be provided ( 10 points)

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

=+ (c) Show that $ is countable if and only if L2 is separable.

Answered: 1 week ago