Starting from:

$25

Engr421 - Introduction to Machine Learning - Homework 01 - Multivariate Parametric Classif - Solved

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:

𝜇! = #++02..05) ,
Σ! = #++30..20
+0.0) ,

+1.2
𝑁! = 120
𝜇" = #−−22..50) ,
Σ" = #+−10..28
−0.8) ,

+1.2
𝑁" = 90
𝜇# = #+−22..50) ,
Σ# = #++10..28
+0.8) ,

+1.2
𝑁# = 90
Your data points should be similar to the following figure.

 

 

                                                                                                             x1                                                           

 

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.

 

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 followin
 

More products