The objectives of this assignment are to:
- Get familiar with the TensorFlow Keras framework for training neural networks.
- Experiment with various hyperparameter choices in feedforward networks.
This assignment builds upon your understanding of backpropagation by introducing high-level model construction using the TensorFlow Keras API. You will design, train, and compare multiple neural network architectures across different datasets.
| File | Description |
|---|---|
notebooks/nn.ipynb |
Main notebook containing the full implementation of feedforward networks in Keras. |
notebooks/nn.py |
Exported Python version of the notebook used for pytest testing. |
notebooks/feedforward_networks.ipynb |
Notebook for running tests and recording pytest results. |
results/nn.html |
Exported HTML version of the notebook for grading and readability. |
tests/test_nn.py |
Provided test file used to validate correctness using pytest. |
README.md |
This documentation file explaining objectives, setup, and submission instructions. |
requirements.txt |
Python dependencies for reproducibility. |
.gitignore |
Specifies intentionally untracked files to keep the repository clean. |
You will complete the following functions using the TensorFlow Keras API:
| Function | Description | Marks |
|---|---|---|
create_auto_mpg_deep_and_wide_networks(n_inputs, n_outputs) |
Creates one deep and one wide neural network for predicting vehicle fuel efficiency (Auto MPG dataset). Both models should have a similar number of parameters and identical activation functions. | 5 |
create_activity_dropout_and_nodropout_networks(n_inputs, n_outputs) |
Creates one neural network with dropout after each Dense layer and another without dropout for classifying human activities (UCI-HAR dataset). | 5 |
create_income_earlystopping_and_noearlystopping_networks(n_inputs, n_outputs) |
Creates two neural networks for classifying income level (Adult dataset) — one using early stopping during training and one without early stopping. | 5 |
| Total Marks | 15 |
This project reuses the shared environment created for previous assignments.
# Activate your existing environment
source ~/venvs/ml-env/bin/activate
# Navigate to the assignment directory
cd ~/projects/info527-neural-networks-assignment3
# Install dependencies
pip install -r requirements.txtrequirements.txt
tensorflow>=2.13
keras>=2.13
numpy>=1.24
pytest>=7.0
jupyter>=1.0
ipykernel>=6.0
-
Run all cells in
nn.ipynbto complete your implementation. -
Export the notebook as:
nn.ipynbnn.htmlnn.py
-
Copy
nn.pyinto the same folder astest_nn.py. -
Run pytest to verify correctness:
pytest tests/test_nn.pyExpected Output:
8.2 RMSE for baseline on Auto MPG
6.2 RMSE for deep on Auto MPG
3.9 RMSE for wide on Auto MPG
.
18.2% accuracy for baseline on UCI-HAR
93.8% accuracy for dropout on UCI-HAR
91.7% accuracy for no dropout on UCI-HAR
.
25.4% accuracy for baseline on census income
79.0% accuracy for early on census income
77.8% accuracy for late on census income
.
============================== 3 passed in 23.16s ==============================
Submit the following for grading:
nn.ipynbnn.htmlnn.pyfeedforward_networks.ipynb(with pytest results)
Repository name: info527-neural-networks-assignment3
Description: Implementation of feedforward neural networks using TensorFlow Keras, including deep vs. wide architectures, dropout regularization, and early stopping. Includes pytest validation and reproducibility setup. Part of the Master’s in MIS/ML program at the University of Arizona.
This repository was completed as part of INFO 527: Neural Networks, under the M.S. in Information Science and Machine Learning program (2023–2025).