Description
In this homework, you will implement a multivariate parametric classification algorithm in
Matlab, Python, or R. 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:
�! = #
+0.0
+2.5
), Σ! = #
+3.2 +0.0
+0.0 +1.2
), �! = 120
�” = #
−2.5
−2.0
), Σ” = #
+1.2 −0.8
−0.8 +1.2
), �” = 90
�# = #
+2.5
−2.0
), Σ# = #
+1.2 +0.8
+0.8 +1.2
), �# = 90
Your data points should be similar to the following figure.
3. Estimate the parameters �3!, �3″, �3#, �5!, �5″, �5#, �7(� = 1), �7(� = 2), and �7(� = 3) using
the data points you generated in the previous step. Your parameter estimations should be
similar to the following figures.
−6 −4 −2 0 2 4 6
−6
−4
−2
0
2
4
6
x1
x2
print(sample_means)
## [,1] [,2] [,3]
## [1,] 0.1555793 -2.394584 2.483595
## [2,] 2.6628991 -2.098373 -2.116054
print(sample_covariances)
## , , 1
##
## [,1] [,2]
## [1,] 3.54503797 -0.09391921
## [2,] -0.09391921 1.13613311
##
## , , 2
##
## [,1] [,2]
## [1,] 1.1513251 -0.8314826
## [2,] -0.8314826 1.3774658
##
## , , 3
##
## [,1] [,2]
## [1,] 0.9969161 0.6507806
## [2,] 0.6507806 1.1967356
print(class_priors)
## [1] 0.4 0.3 0.3
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 similar to the following matrix.
## y_truth
## y_predicted 1 2 3
## 1 119 0 2
## 2 0 90 1
## 3 1 0 89
5. Draw your decision boundaries 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 similar to the following figure.
What to submit: You need to submit your source code in a single file (.m file if you are using
Matlab, .py file if you are using Python, or .R file if you are using R) 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.
Late submission policy: Late submissions will not be graded.
Cheating policy: Very similar submissions will not be graded.
−6 −4 −2 0 2 4 6
−6
−4
−2
0
2
4
6
x1
x2