Sale!

CPSC 585 – Artificial Neural Networks Project 3

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (5 votes)

In this project you will attempt the character recognition problem from Projects 1 and 2 using shallow multiclass networks and compare their performance to the performance of multiple binary perceptrons.

The project may be completed individually, or in a group of no more than three (3) students.

Platforms

The platform requirements for this project are the same as for Project 1.

Libraries and Code

Vector and matrix operations for this project must be implemented in NumPy, without recourse to other libraries.

Code from A Whirlwind Tour of Python, the library documentation, and the sample code provided below may be reused. All other code and the results of experiments must be your own original work or the original work of other members of your team.

The Google Colaboratory notebook Binary Perceptrons in NumPy demonstrates how to solve the character recognition problem from Project 1 using NumPy.

Dataset

This project uses the same dataset as Projects 1 and 2. You do not need to have completed either of those projects in order to complete this project.

Experiments

Run the following experiments in a Jupyter notebook, performing each action in a code cell and answering each question in a Markdown cell.

  1. Use from dataset import * to load the module, then examine TRAINING_SET, TEST_SET, and MESSAGE.
  2. In order to use the images in TRAINING_SET, TEST_SET, and MESSAGE, convert them into two-dimensional NumPy arrays of feature vectors.
  3. Implementing a Python function show(image) to reshape a one-dimensional feature vector into a 7×5 array, then print() the image. Test this function on some of the images in the training set.
  4. In order to use the character labels in TRAINING_SET and TEST_SET, convert them into an integer class vector using ord(), then use NumPy to convert them into 26 one-hot encoded vectors.

Note that if you did this for Project 2 using Keras, this conversion must be performed using NumPy directly.

  1. Implement a multiclass perceptron as described in Section 2.3.1 of the textbook to recognize the letters A-Z.

Begin with weights initialized to random values and a learning rate of 𝛼 = 0.01. Predict the letter by choosing the class with the largest r∙X̅i value.

If the prediction is incorrect, train the multiclass perceptron by applying the update rule of Equation 2.24 in the textbook. Continue training until all items in the training set are correctly classified.

  1. Use your trained multiclass perceptron to classify each image in the test set.

Apply the weights to all feature vectors in the test set at once using np.matmul(), then make predictions using np.argmax().

What accuracy do you obtain? If the accuracy is less than 100%, which test images are misclassified?

  1. Implement and train a multinomial logistic regression classifier as described in Section 2.3.3 of the textbook.

Begin with weights initialized to random values and a learning rate of 𝛼 = 0.01. Predict the letter using the softmax activation function of Equation 2.29 in the textbook.

Train the classifier by applying the update rule of Equation 2.37 in the textbook until all items in the training set are correctly classified.

  1. Repeat experiment (6) with your softmax classifier. You can find the formula for applying softmax using NumPy in the documentation for SciPy’s softmax() function.
  2. Use your trained classifiers to identify the letters in MESSAGE

If you completed Project 1, compare the performance of that project with the performance with these classifiers. If you did not complete Project 1, use the sample code provided above under Libraries and Code.

If you completed Project 2 compare the performance of that project with the performance of these classifiers.

Submission

A Markdown cell at the top of the notebook should include project summary information as described in the Syllabus for README files.

Since you may be actively editing and making changes to the code cells in your notebook, be certain that each of your code cells still runs correctly before submission. You may wish to do this by selecting Run All from the drop-down menu bar.

Submit your Jupyter .ipynb notebook file through Canvas before class on the due date.

If the assignment is completed by a team, only one submission is required. Be certain to identify the names of all students on your team at the top of the notebook. See the following sections of the Canvas documentation for instructions on group submission: