Description
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.
Reviews
There are no reviews yet.