Starting from:

$29.99

ENGR 421 / DASC 521 Homework 03- Discrimination by Regression Solution



In this homework, you will implement a discrimination by regression algorithm for multiclass classification using Python. Here are the steps you need to follow:
1. Your discrimination by regression algorithm will be developed using the following modifications to the linear discrimination algorithm with the softmax function we discussed in the lectures.
b. Instead of the negative log-likelihood (i.e., − ∑&!$% ∑#"$% 𝑦!" log 𝑦#!" ), you are going to use the sum squared errors as the error function to minimize (i.e.,

2. Generate random data points from three bivariate Gaussian densities with the following parameters:
𝝁% = 1++02..054 , 𝚺% = 1++30..20 +0.04 ,
+1.2 𝑁% = 120
𝝁’ = 1−−22..504 , 𝚺’ = 1++10..28 +0.84 ,
+1.2 𝑁’ = 80
𝝁( = 1+−22..504 , 𝚺( = 1+−10..28 −0.84 ,
+1.2 𝑁( = 100
Your data points should be like the following figure.


3. Learn a discrimination by regression algorithm for this multiclass classification problem using the following learning parameters.
eta = 0.01
epsilon = 0.001

Your parameter estimations should be like the following figures.
print(W) print(w0)

[[ 0.02528161 -2.23729285 2.44057305]
[ 4.60790215 -2.46097419 -2.26881565]]
[[-1.13651539 -4.28418412 -3.6081088 ]]

4. Draw the objective function values throughout the iterations. Your figure should be like the following figure.


5. Calculate the confusion matrix for the data points in your training set using the discrimination by regression algorithm you will develop using the estimated parameters from Step 3. Your confusion matrix should be like the following matrix.

y_truth 1 2 3 y_pred 1 117 1 3
2 2 78 0
3 1 1 97

6. Draw your decision boundaries that you will calculate using the discrimination by regression algorithm you will develop using the estimated parameters from Step 3 together with data points and clearly mark misclassified data points. Your figure should be like the following figure.


What to submit: You need to submit your source code in a single file (.py file) and a short report explaining your approach (.doc, .docx, or .pdf file). You will put these two files in a single zip file named as STUDENTID.zip, where STUDENTID should be replaced with your 7-digit student number.
How to submit: Submit the zip file you created to Blackboard. Please follow the exact style mentioned and do not send a zip file named as STUDENTID.zip. Submissions that do not follow these guidelines will not be graded.
Cheating policy: Very similar submissions will not be graded.

More products