Starting from:

$29.99

ENGR 421 / DASC 521 Homework 1 Solution


In this homework, you will implement a multivariate parametric classification algorithm using Python. Here are the steps you need to follow:
1. Read Chapter 5 from the textbook.

2. Generate random data points from three bivariate Gaussian densities with the following parameters:
𝝁! = #++02..05) , 𝚺! = #++30..20 +0.0) ,
+1.2 𝑁! = 120
𝝁" = #−−22..50) , 𝚺" = #++10..28 +0.8) ,
+1.2 𝑁" = 80
𝝁# = #+−22..50) , 𝚺# = #+−10..28 −0.8) ,
+1.2 𝑁# = 100
Your data points should be like the following figure.



3. Estimate the parameters 𝝁1!, 𝝁1", 𝝁1#, 𝚺2!, 𝚺2", 𝚺2#, 𝑃4(𝑦 = 1), 𝑃4(𝑦 = 2), and 𝑃4(𝑦 = 3) using the data points you generated in the previous step. Your parameter estimations should be like the following figures.

print(sample_means)
[[-0.06002769 2.37891762]
[-2.48316966 -2.07440702]
[ 2.566945 -1.97561107]]

print(sample_covariances) [[[ 3.50095107 0.31087713]
[ 0.31087713 1.21501349]]

[[ 1.19789275 0.64059315]
[ 0.64059315 0.95264856]]

[[ 1.25199541 -0.79696973]
[-0.79696973 1.17191475]]]

print(class_priors)
[0.4, 0.26666666666666666, 0.3333333333333333]

4. Calculate the confusion matrix for the data points in your training set using the parametric classification rule you will develop using the estimated parameters from the previous step. Your confusion matrix should be like the following matrix.

y_truth 1 2 3 y_pred 1 119 1 2
2 1 79 0
3 0 0 98

5. Draw your decision boundaries that you will calculate using the parametric classification rule from the previous step 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