CSE 474/574 Introduction To Machine Learning Fall 2011 Assignment 3
CSE 474/574 Introduction To Machine Learning Fall 2011 Assignment 3
The assignment is due at the beginning of the class on the above mentioned due
date. Submit a hard copy in class. Attach print out of code, figures/results of any coding
questions in your hard copy along with answers to other questions.
C1 C2
Sample x1 x2 x1 x2
1 1.7 3.0 1.1 -1.3
2 1.2 3.5 0.2 3.5
3 1.5 5.0 1.5 4.3
4 0.6 4.5 3.2 0.8
5 0.5 4.0 4.0 2.7
y(x) = X
eWf
1
Where W f is a (D + 1) × K matrix whose kth column is a (D + 1) × 1 weight vector
e is the augmented input vector of size N × (D + 1).
for the Ck class. X
(a) Write a Matlab program to calculate w using the same data you have generated
in 1b. Plot the projection line which is on the direction of w (as a line passing
(0,0) on the same figure of the marked data points. [12]
(b) Find the values of projected 1-D points y(x) for both classes. To construct a
discriminant, assume the class-conditional densities p(y|Ck ) using 1-D Gaussian
distribution by maximum likelihood. Then when set ln p(y|C1 ) = ln p(y|C2 ) with
an assumption of equal prior, we can found a threshold y0 . Derive the solution to
y0 and classify each data point as belonging to C1 if y(x) ≥ y0 and classify it as
belonging to C2 otherwise. [12]
(c) Calculate the error rate (rate for misclassified samples) and comment on the result.
[6]
(a) Using equation (4.57) and (4.58) form the textbook, derive the result (4.65) for
the posterior class probability in the two-class generative model with Gaussian
densities, and verify the results (4.66) and (4.67) for the parameters w and w0. [6]
(b) Comment on the discriminative function (decision boundary) in case of all two
classes share the same covariance matrix. [4]
2
(c) Evaluate the discriminative function in Matlab using the 2-D data you have gen-
erated in 1c by computing parameters w as a 21 vector and w0 as a scaler in
(4.66) and (4.67). Plot and verify the decision boundary on the sample figure of
the data points. [6]
5. Logistic Regression
Show that for a linearly separable data set, the maximum likelihood solution for the
logistic regression model is obtained by finding a vector w whos decision boundary
wT φ(x) = 0 separates the classes and then taking the magnitude of w to infinity. [6]