Homework 01: Multivariate Parametric Classification
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 four bivariate Gaussian densities with the following parameters:
π =#+0.0), ! +4.5
π”=#β4.5), β1.0
π#=#+4.5), β1.0
π$=#+0.0), β4.0
πΊ = #+3.2 ! +0.0
πΊ” = #+1.2 +0.8
πΊ# = #+1.2 β0.8
πΊ$ = #+1.2 +0.0
+0.0), π =105 +1.2 !
+0.8), π”=145 +1.2
β0.8), π#=135 +1.2
+0.0), π$=115 +3.2
Your data points should be like the following figure. (10 points)
3. Estimate the parameters π2!, π2″, π2#, π2$, πΊ3!, πΊ3″, πΊ3#, πΊ3$, π5(π¦ = 1), π5(π¦ = 2), π5(π¦ = 3), and π5(π¦ = 4) using the data points you generated in the previous step. Your parameter estimations should be like the following figures.
print(sample_means) [[-2.43085714e-04 4.41475305e+00]
[-4.40159367e+00 -1.00817799e+00] [ 4.53185568e+00 -9.79534452e-01] [-3.20267739e-02 -3.79497784e+00]]
print(sample_covariances) [[[ 3.46382957 0.26022464]
[ 0.26022464 1.19547019]]
[[ 1.34545849 0.78772458] [ 0.78772458 1.11187005]]
[[ 1.27229804 -0.66903494] [-0.66903494 0.96283015]]
[[ 1.44282286 -0.20544896] [-0.20544896 3.2734625 ]]]
print(class_priors) [0.21 0.29 0.27 0.23]
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.
print(confusion_matrix) y_truth 1 2 3 4 y_pred
1 104 1 1 0 2 114400 3 001330 4 001115
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.



