Assignment 02 (Due date: Oct. 06, 2024)
Neural Networks
Assignment 02
Due date: Oct. 6, 2024
Multi-Layer Neural Network with PyTorch
The goal of this assignment is to implement a multi-layer neural network model using PyTorch.
To begin this assignment download the Kamangar_02.zip and unzip it in your computer.
 
  • The neural network model in this assignment is a multi-layer of neurons with multiple nodes in each layer.
  • Your code should be using PyTorch and numpy. DO NOT use any other high-level API, package or library.
  • DO NOT alter/change the name of the function or the parameters of the function.
  • You may introduce additional functions (helper functions) as needed. All the helper functions should be put in the same file with multi_layer_nn_torch()  function.
  • The comments in the multi_layer_nn_torch()  function provide additional information that should help with your implementation.
  • The "Assignment_02_tests.py" file includes a very minimal set of unit tests for the multi_layer_nn_torch()  function. The assignment grade will be based on your code passing these tests (and other additional tests).
  • You may modify the "Assignment_02_tests.py" to include more tests. You may also add additional tests to help you during development of your code.
  • DO NOT submit the "Assignment_02_tests.py" file when submitting your Assignment_02
  • You may run these tests using the command:      py.test --verbose Assignment_02_tests.py
  • Submit the output of running the test cases as a separate text file as part of your submission.
 
The following is roughly what your output should look like if all tests pass
  
Assignment_02_tests.py::test_random_weight_init PASSED                   [ 10%]
Assignment_02_tests.py::test_weight_update_mse PASSED                    [ 20%]
Assignment_02_tests.py::test_weight_update_cross_entropy PASSED          [ 30%]
Assignment_02_tests.py::test_weight_update_svm PASSED                    [ 40%]
Assignment_02_tests.py::test_assign_weights_by_value PASSED              [ 50%]
Assignment_02_tests.py::test_error_output_dimensions PASSED              [ 60%]
Assignment_02_tests.py::test_error_vals_mse PASSED                       [ 70%]
Assignment_02_tests.py::test_error_vals_cross_entropy PASSED             [ 80%]
Assignment_02_tests.py::test_initial_validation_output PASSED            [ 90%]
Assignment_02_tests.py::test_many_layers PASSED                          [100%]
 
======================== 10 passed, 1 warning in 5.80s ======================== 
Process finished with exit code 0
 
 
 Grading Criteria
  • Your submitted function will be tested with multiple test units.
  • Passing the tests - 90 points
  • Qualitative Evaluation - 10 points (Grader may examine your code and subjectively award as many as 20 points.)
 
Submission Guidelines
  • The first four lines of any submitted file must follow the following format according to the assignment submission guidelines.
# Your name (last name, first name)
# Your student ID (100x_xxx_xxx)
# Date of submission (yyyy_mm_dd)
# Assignment_nn_kk
 
  • Change the name of the file according to the submission guidelines.
  • Create a directory and name it according to the submission guidelines and include your file in that directory.
  • Zip the directory and upload it  to Canvas according to the submission guidelines.