HW03: Multilayer Perceptron for Multiclass Discrimination Solution

$30.00

Description

In this homework, you will implement a multilayer perceptron for multiclass discrimination in R, Matlab, or Python. Here are the steps you need to follow:

  1. Read Section 11.7.3 from the textbook.

  1. 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:

    1. hw02_data_set_images.csv: letter images,

    1. hw02_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.

  1. Train a multilayer perceptron for multiclass discrimination using the sigmoid activation function for twenty nodes in the hidden layer ( = 20) and using the softmax activation function for five nodes in the output layer. You should develop a backpropagation algorithm under batch learning scenario with the following learning parameters.

eta <- 0.005

epsilon <- 1e-3

H<-20

max_iteration <- 200

set.seed(521)

  1. Draw the objective function values throughout the iterations. Your figure should be similar to the following figure.

200

150

Error

100

50

0

0

50

100

150

200

Iteration

6.

Calculate

the

confusion

matrix

for

the

data

points

in

your

training

set

using

the

discrimination rule you will develop using the trained multilayer perceptron. Your confusion matrix should be similar to the following matrix.

y_predicted

y_train

3

4

5

1

2

1

25

0

0

0

0

2

0

25

0

0

0

3

0

0

25

0

0

4

0

0

0

25

0

5

0

0

0

0

25

  1. Calculate the confusion matrix for the data points in your test set using the discrimination rule you will develop using the trained multilayer perceptron. Your confusion matrix should be similar to the following matrix.

y_predicted

y_test

3

4

5

1

2

1

13

1

0

0

0

2

1

13

0

0

0

3

0

0

14

0

1

4

0

0

0

14

0

5

0

0

0

0

13

What to submit: You need to submit your source code in a single file (.R file if you are using R,

.m file if you are using Matlab, or .py file if you are using Python) 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: E-mail the zip file you created to jsayilgan14@ku.edu.tr with the subject line Intro2MachineLearningHW03. Please follow the exact style mentioned for the subject line 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.


error: Content is protected !!