Engr421 Project 3-Naïve Bayes’ Classifier Solved

35.00 $

Category:

Description

Rate this product

 

In this homework, you will implement a naïve Bayes’ classifier in Matlab, Python, or R. Here are the steps you need to follow:

  1. Read Section 5.7 from the textbook.
  2. You are given a multivariate classification data set, which contains 195 handwritten letters of size 20 pixels × 16 pixels (i.e., 320 pixels). These images are from five distinct classes, namely, A, B, C, D, and E, where we have 39 data points from each class. The figure below shows five sample figures from each class. You are given two data files:

    a. hw03_data_set_images.csv: letter images,
    b. hw03_data_set_labels.csv: corresponding class labels.

  1. Divide the data set into two parts by assigning the first 25 images from each class to the training set and the remaining 14 images to the test set.
  2. Estimate the parameters 𝒑#!, 𝒑#”, 𝒑##, 𝒑#$, 𝒑#%, 𝑃&(𝑦 = 1), 𝑃&(𝑦 = 2), 𝑃&(𝑦 = 3), 𝑃&(𝑦 = 4), and 𝑃&(𝑦 = 5) using the data points you assigned to the training set in the previous step. Your parameter estimations should be similar to the following figures.
     > print(pcd[,1])
     [1] 0.00 0.00 0.00 0.04 0.04 0.04 0.16 0.20 ...
     > print(pcd[,2])
     [1] 0.04 0.24 0.24 0.20 0.12 0.08 0.12 0.16 ...
     > print(pcd[,3])
     [1] 0.00 0.00 0.00 0.00 0.00 0.12 0.20 0.24 ...
     > print(pcd[,4])
     [1] 0.12 0.44 0.40 0.16 0.12 0.08 0.08 0.08 ...
     > print(pcd[,5])
     [1] 0.00 0.12 0.12 0.08 0.12 0.16 0.12 0.04 ...
  1. Draw your 𝒑#!, 𝒑#”, 𝒑##, 𝒑#$ and 𝒑#% parameter estimations as images.
  2. Calculate the confusion matrix for the data points in your training set using the parametric discrimination rule you will develop using the estimated parameters. Your confusion matrix should be similar to the following matrix.
                    y_train
         y_predicted  1  2  3  4  5
    

    1 25 0 0 0 0 2 024 1 0 1 3 0 0 24 0 0 4 0 1 0 25 0 5 0 0 0 0 24

  3. Calculate the confusion matrix for the data points in your test set using the parametric discrimination rule you will develop using the estimated parameters. Your confusion matrix should be similar to the following matrix.
                    y_test
         y_predicted  1  2  3  4  5
    

    170000 2 0 11 3 2 4 300700 4 7 3 312 0 5 0 0 1 0 10

 

  • Project-3-fy3wfg.zip